Skip to content

Commit

Permalink
Fix #26 -- Change workflow URLs to expect an integer PK
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Jan 8, 2021
1 parent 25fd79a commit bdb94d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions joeflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def urls(cls):
if isinstance(node, BaseCreateView):
route = "{name}/".format(name=name)
else:
route = "{name}/<pk>/".format(name=name)
route = "{name}/<int:pk>/".format(name=name)
urls.append(
path(
route + node.path,
Expand All @@ -147,12 +147,12 @@ def urls(cls):
)
if cls.detail_view:
urls.append(
path("<pk>/", cls.detail_view.as_view(model=cls), name="detail")
path("<int:pk>/", cls.detail_view.as_view(model=cls), name="detail")
)
if cls.override_view:
urls.append(
path(
"<pk>/override",
"<int:pk>/override",
cls.override_view.as_view(model=cls),
name="override",
)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ class Meta:
"override",
}

def test_urls__none_int_pk_mismatch(self, client):
response = client.get("/shipment/test/")
assert response.status_code == 404


class TestTaskQuerySet:
def test_scheduled(self, db):
Expand Down

0 comments on commit bdb94d8

Please sign in to comment.