Dalai Felinto
d00bcc585a
When submitting a file the created extension gets a user right away. This makes sure there are no orphans extensions. The extension is then incomplete until the draft is saved once (which means finalizing the extension upload process, by adding a description and thumbnails). Any attempt to edit or submit a new extension will lead the user to the editing draft page. Note: We could add a new option to [x] Send for Review. The front-end even has a half-baked code for that. But should be tackled separately. ------------ Patch notes: * Originally when trying to finish an upload as a different user we woudl get a 403, now we get a 404. Reviewed-on: #54 Reviewed-by: Francesco Siddi <fsiddi@noreply.localhost>
83 lines
3.3 KiB
Python
83 lines
3.3 KiB
Python
from django.urls import path, re_path, include, reverse_lazy
|
|
from django.views.generic import RedirectView
|
|
|
|
from constants.base import EXTENSION_SLUGS_PATH
|
|
from extensions.views import api, public, submit, manage
|
|
|
|
app_name = 'extensions'
|
|
urlpatterns = [
|
|
path('submit/', submit.UploadFileView.as_view(), name='submit'),
|
|
# TODO: move /accounts pages under its own app when User model is replaced
|
|
path('accounts/extensions/', manage.ManageListView.as_view(), name='manage-list'),
|
|
# FIXME: while there's no profile page, redirect to My Extensions instead
|
|
path(
|
|
'accounts/profile/',
|
|
RedirectView.as_view(url=reverse_lazy('extensions:manage-list'), permanent=False),
|
|
),
|
|
# API
|
|
path('api/v1/extensions/', api.ExtensionsAPIView.as_view(), name='api'),
|
|
# Public pages
|
|
path('', public.HomeView.as_view(), name='home'),
|
|
path('', api.ExtensionsAPIView.as_view(), name='home-api'),
|
|
path('search/', public.SearchView.as_view(), name='search'),
|
|
path('author/<int:user_id>/', public.SearchView.as_view(), name='by-author'),
|
|
path('search/', public.SearchView.as_view(), name='search'),
|
|
path('tag/<slug:tag_slug>/', public.SearchView.as_view(), name='by-tag'),
|
|
path('team/<slug:team_slug>/', public.SearchView.as_view(), name='by-team'),
|
|
re_path(
|
|
rf'^(?P<type_slug>{EXTENSION_SLUGS_PATH})/$',
|
|
public.SearchView.as_view(),
|
|
name='by-type',
|
|
),
|
|
# Pages for maintainers
|
|
re_path(
|
|
rf'^(?P<type_slug>{EXTENSION_SLUGS_PATH})/',
|
|
include(
|
|
[
|
|
path(
|
|
'<slug:slug>/draft/',
|
|
manage.DraftExtensionView.as_view(),
|
|
name='draft',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/',
|
|
manage.UpdateExtensionView.as_view(),
|
|
name='manage',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/versions/',
|
|
manage.ManageVersionsView.as_view(),
|
|
name='manage-versions',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/versions/new/',
|
|
manage.NewVersionView.as_view(),
|
|
name='new-version',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/versions/new/<int:pk>/',
|
|
manage.NewVersionFinalizeView.as_view(),
|
|
name='new-version-finalise',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/versions/<int:pk>/delete/',
|
|
manage.VersionDeleteView.as_view(),
|
|
name='version-delete',
|
|
),
|
|
path(
|
|
'<slug:slug>/manage/versions/<int:pk>/update/',
|
|
manage.UpdateVersionView.as_view(),
|
|
name='version-update',
|
|
),
|
|
path(
|
|
'<slug:slug>/<version>/download/',
|
|
public.extension_version_download,
|
|
name='version-download',
|
|
),
|
|
path('<slug:slug>/versions/', manage.VersionsView.as_view(), name='versions'),
|
|
path('<slug:slug>/', manage.ExtensionDetailView.as_view(), name='detail'),
|
|
],
|
|
),
|
|
),
|
|
]
|