Skip to content

Commit

Permalink
Fix Ajax URL breaking with base_url (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Oct 2, 2023
1 parent 6f13ad2 commit 0abdef0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sqladmin/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
cast,
no_type_check,
)
from urllib.parse import urljoin

from jinja2 import ChoiceLoader, FileSystemLoader, PackageLoader
from sqlalchemy.engine import Engine
Expand Down Expand Up @@ -222,7 +223,9 @@ class UserAdmin(ModelView, model=User):
# Set database engine from Admin instance
view.session_maker = self.session_maker
view.is_async = self.is_async
view.ajax_lookup_url = f"{self.base_url}/{view.identity}/ajax/lookup"
view.ajax_lookup_url = urljoin(
self.base_url + "/", f"{view.identity}/ajax/lookup"
)
view.templates = self.templates
view_instance = view()

Expand Down

0 comments on commit 0abdef0

Please sign in to comment.