Skip to content

Commit

Permalink
Refactorise les patterns d'URL pour les tutoriels
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D committed Dec 10, 2023
1 parent e6c7847 commit 0c65fce
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions zds/tutorialv2/urls/urls_tutorials.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,30 @@
from zds.tutorialv2.views.redirect import RedirectContentSEO, RedirectOldBetaTuto
from zds.tutorialv2.feeds import LastTutorialsFeedRSS, LastTutorialsFeedATOM


urlpatterns = [
# flux
feed_patterns = [
path("flux/rss/", LastTutorialsFeedRSS(), name="feed-rss"),
path("flux/atom/", LastTutorialsFeedATOM(), name="feed-atom"),
# view
path(
"<int:pk>/<slug:slug>/<int:p2>/<slug:parent_container_slug>/<int:p3>/<slug:container_slug>/",
RedirectContentSEO.as_view(),
name="redirect_old_tuto",
),
]

display_patterns = [
path(
"<int:pk>/<slug:slug>/<slug:parent_container_slug>/<slug:container_slug>/",
ContainerOnlineView.as_view(),
name="view-container",
),
path("<int:pk>/<slug:slug>/<slug:container_slug>/", ContainerOnlineView.as_view(), name="view-container"),
path("<int:pk>/<slug:slug>/", TutorialOnlineView.as_view(), name="view"),
# downloads:
]

download_patterns = [
path("md/<int:pk>/<slug:slug>.md", DownloadOnlineTutorial.as_view(requested_file="md"), name="download-md"),
path("pdf/<int:pk>/<slug:slug>.pdf", DownloadOnlineTutorial.as_view(requested_file="pdf"), name="download-pdf"),
path("epub/<int:pk>/<slug:slug>.epub", DownloadOnlineTutorial.as_view(requested_file="epub"), name="download-epub"),
path("zip/<int:pk>/<slug:slug>.zip", DownloadOnlineTutorial.as_view(requested_file="zip"), name="download-zip"),
path("tex/<int:pk>/<slug:slug>.tex", DownloadOnlineTutorial.as_view(requested_file="tex"), name="download-tex"),
# Old beta url compatibility
path("beta/<int:pk>/<slug:slug>/", RedirectOldBetaTuto.as_view(), name="old-beta-url"),
# Listing
]

listing_patterns = [
path("", RedirectView.as_view(pattern_name="publication:list", permanent=True)),
path("tags/", TagsListView.as_view(displayed_types=["TUTORIAL"]), name="tags"),
path(
Expand All @@ -48,3 +45,14 @@
name="find-contributions-tutorial",
),
]

redirect_patterns = [
path(
"<int:pk>/<slug:slug>/<int:p2>/<slug:parent_container_slug>/<int:p3>/<slug:container_slug>/",
RedirectContentSEO.as_view(),
name="redirect_old_tuto",
),
path("beta/<int:pk>/<slug:slug>/", RedirectOldBetaTuto.as_view(), name="old-beta-url"),
]

urlpatterns = feed_patterns + display_patterns + download_patterns + listing_patterns + redirect_patterns

0 comments on commit 0c65fce

Please sign in to comment.