Skip to content

Commit

Permalink
Rename item slug to item_id
Browse files Browse the repository at this point in the history
  • Loading branch information
rstorey committed Mar 4, 2019
1 parent 2886057 commit 2f47107
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions concordia/converters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.urls.converters import SlugConverter
from django.urls.converters import SlugConverter, StringConverter


class UnicodeSlugConverter(SlugConverter):
Expand All @@ -7,6 +7,6 @@ class UnicodeSlugConverter(SlugConverter):
regex = r"[-\w+]+"


class ItemSlugConverter(SlugConverter):
class ItemIdConverter(StringConverter):
# Allows . in the item ID
regex = r"[-a-zA-Z0-9_\.]+"
14 changes: 10 additions & 4 deletions concordia/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from . import converters, views

register_converter(converters.UnicodeSlugConverter, "uslug")
register_converter(converters.ItemSlugConverter, "islug")
register_converter(converters.ItemIdConverter, "item_id")

tx_urlpatterns = (
[
Expand All @@ -36,7 +36,10 @@
name="project-export-bagit",
),
path(
"<uslug:campaign_slug>/<uslug:project_slug>/<islug:item_id>/export/bagit/",
(
"<uslug:campaign_slug>/<uslug:project_slug>/"
"<item_id:item_id>/export/bagit/"
),
exporter_views.ExportItemToBagIt.as_view(),
name="item-export-bagit",
),
Expand All @@ -46,7 +49,10 @@
name="campaign-report",
),
path(
"<uslug:campaign_slug>/<uslug:project_slug>/<islug:item_id>/<uslug:slug>/",
(
"<uslug:campaign_slug>/<uslug:project_slug>/"
"<item_id:item_id>/<uslug:slug>/"
),
views.AssetDetailView.as_view(),
name="asset-detail",
),
Expand All @@ -67,7 +73,7 @@
name="project-detail",
),
path(
"<uslug:campaign_slug>/<uslug:project_slug>/<islug:item_id>/",
"<uslug:campaign_slug>/<uslug:project_slug>/<item_id:item_id>/",
views.ItemDetailView.as_view(),
name="item-detail",
),
Expand Down

0 comments on commit 2f47107

Please sign in to comment.