diff --git a/pretalx_pages/models.py b/pretalx_pages/models.py index 706ddbc..34032b3 100644 --- a/pretalx_pages/models.py +++ b/pretalx_pages/models.py @@ -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." ), diff --git a/pretalx_pages/urls.py b/pretalx_pages/urls.py index a4aa4c4..5031c38 100644 --- a/pretalx_pages/urls.py +++ b/pretalx_pages/urls.py @@ -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[{SLUG_CHARS}]+)/pages/$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/$", views.PageList.as_view(), name="index", ), re_path( - rf"^orga/event/(?P[{SLUG_CHARS}]+)/pages/create$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/create$", views.PageCreate.as_view(), name="create", ), re_path( - rf"^orga/event/(?P[{SLUG_CHARS}]+)/pages/(?P[{SLUG_CHARS}]+)/$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/(?P{SLUG_REGEX})/$", views.PageUpdate.as_view(), name="edit", ), re_path( - rf"^orga/event/(?P[{SLUG_CHARS}]+)/pages/(?P[{SLUG_CHARS}]+)/delete$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/(?P{SLUG_REGEX})/delete$", views.PageDelete.as_view(), name="delete", ), re_path( - rf"^orga/event/(?P[{SLUG_CHARS}]+)/pages/(?P[{SLUG_CHARS}]+)/up$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/(?P{SLUG_REGEX})/up$", views.page_move_up, name="up", ), re_path( - rf"^orga/event/(?P[{SLUG_CHARS}]+)/pages/(?P[{SLUG_CHARS}]+)/down$", + rf"^orga/event/(?P{SLUG_REGEX})/pages/(?P{SLUG_REGEX})/down$", views.page_move_down, name="down", ), re_path( - rf"^(?P[{SLUG_CHARS}]+)/page/(?P[^/]+)/$", + rf"^(?P{SLUG_REGEX})/page/(?P[^/]+)/$", views.ShowPageView.as_view(), name="show", ),