Skip to content

Commit

Permalink
Use new SLUG_REGEX for consistent URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed Nov 7, 2023
1 parent e36e5e7 commit 3b22193
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pretalx_pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Page(LogMixin, models.Model):
verbose_name=_("URL to static page"),
validators=[
RegexValidator(
regex="^[a-zA-Z0-9.-]+$",
regex="^[a-zA-Z0-9][a-zA-Z0-9.-]+$",
message=_(
"The slug may only contain letters, numbers, dots and dashes."
),
Expand Down
16 changes: 8 additions & 8 deletions pretalx_pages/urls.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
from django.urls import re_path
from pretalx.event.models.event import SLUG_CHARS
from pretalx.event.models.event import SLUG_REGEX

from . import views

urlpatterns = [
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/$",
views.PageList.as_view(),
name="index",
),
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/create$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/create$",
views.PageCreate.as_view(),
name="create",
),
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/(?P<page>[{SLUG_CHARS}]+)/$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/(?P<page>{SLUG_REGEX})/$",
views.PageUpdate.as_view(),
name="edit",
),
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/(?P<page>[{SLUG_CHARS}]+)/delete$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/(?P<page>{SLUG_REGEX})/delete$",
views.PageDelete.as_view(),
name="delete",
),
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/(?P<page>[{SLUG_CHARS}]+)/up$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/(?P<page>{SLUG_REGEX})/up$",
views.page_move_up,
name="up",
),
re_path(
rf"^orga/event/(?P<event>[{SLUG_CHARS}]+)/pages/(?P<page>[{SLUG_CHARS}]+)/down$",
rf"^orga/event/(?P<event>{SLUG_REGEX})/pages/(?P<page>{SLUG_REGEX})/down$",
views.page_move_down,
name="down",
),
re_path(
rf"^(?P<event>[{SLUG_CHARS}]+)/page/(?P<slug>[^/]+)/$",
rf"^(?P<event>{SLUG_REGEX})/page/(?P<slug>[^/]+)/$",
views.ShowPageView.as_view(),
name="show",
),
Expand Down

0 comments on commit 3b22193

Please sign in to comment.