Skip to content

Commit

Permalink
Change pk converter in routes
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee committed Nov 11, 2023
1 parent 52177cc commit e3775e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sqladmin/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def __init__(
Mount("/statics", app=statics, name="statics"),
Route("/", endpoint=self.index, name="index"),
Route("/{identity}/list", endpoint=self.list, name="list"),
Route("/{identity}/details/{pk}", endpoint=self.details, name="details"),
Route("/{identity}/details/{pk:path}", endpoint=self.details, name="details"),
Route(
"/{identity}/delete",
endpoint=self.delete,
Expand All @@ -399,7 +399,7 @@ def __init__(
methods=["GET", "POST"],
),
Route(
"/{identity}/edit/{pk}",
"/{identity}/edit/{pk:path}",
endpoint=self.edit,
name="edit",
methods=["GET", "POST"],
Expand Down
6 changes: 0 additions & 6 deletions sqladmin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ def stream_to_csv(
return callback(writer) # type: ignore


def get_primary_key(model: type) -> Column:
pks = inspect(model).mapper.primary_key
assert len(pks) == 1, "Multiple Primary Keys not supported."
return pks[0]


def get_primary_keys(model: Any) -> Tuple[Column, ...]:
return tuple(inspect(model).mapper.primary_key)

Expand Down

0 comments on commit e3775e0

Please sign in to comment.