-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganized URL patterns in all apps
...to comply with the style guide. The path segments (i.e. the text between the forward slashes) now have a more consistent structure, including being prefixed by `admin/` and `api/` - as described in `CONTRIBUTING.md` - by placing the `path()` calls inside "custom `urlpatterns` lists", like `adminpatterns` and `apipatterns` - also described in `CONTRIBUTING.md`. Of the views whose paths have been changed, the ones that I deemed as relevant, have been added to the "Old URLs" in `web/urls.py` to (permanently) redirect from the old to the new path. Also added permission checks for all admin URLs (indlucing admin API URLs) that require the requesting user to have the `internal.is_internal` permission. Also: * Reordered the tests in all apps' `test_urls.py` to match the order of the paths listed in each app's `urls.py` * Improved some of the parts in `CONTRIBUTING.md` on things related to path naming and organization * Added some missing `ContentBox` tests to `internal/tests/test_urls.py`, as well as all the member GET URLs, as it's useful to have all URLs listed in one place, even if it duplicates some testing * Added some missing tests for the `event_ticket_cancel` URL in `news/tests/test_urls.py`
- Loading branch information
Showing
42 changed files
with
639 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
from django.urls import path | ||
from django.urls import include, path | ||
|
||
from . import views | ||
|
||
|
||
urlpatterns = [ | ||
path("admin/", views.AdminAnnouncementListView.as_view(), name='admin_announcement_list'), | ||
] | ||
|
||
# --- Admin URL patterns (imported in `web/urls.py`) --- | ||
|
||
specific_announcement_adminpatterns = [ | ||
path("change/", views.AnnouncementUpdateView.as_view(), name='announcement_update'), | ||
path("delete/", views.AnnouncementDeleteView.as_view(), name='announcement_delete'), | ||
] | ||
|
||
adminpatterns = [ | ||
path("", views.AdminAnnouncementListView.as_view(), name='admin_announcement_list'), | ||
path("add/", views.AnnouncementCreateView.as_view(), name='announcement_create'), | ||
path("<int:pk>/change/", views.AnnouncementUpdateView.as_view(), name='announcement_update'), | ||
path("<int:pk>/delete/", views.AnnouncementDeleteView.as_view(), name='announcement_delete'), | ||
path("<int:pk>/", include(specific_announcement_adminpatterns)), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
from django.contrib.auth.decorators import login_required | ||
from django.urls import path | ||
from django.urls import include, path | ||
|
||
from . import views | ||
|
||
|
||
urlpatterns = [ | ||
path("", views.UserSkillListView.as_view(), name='user_skill_list'), | ||
path("profile/", login_required(views.ProfileDetailView.as_view()), name='profile_detail'), | ||
path("profile/change/image/", login_required(views.AdminProfilePictureUpdateView.as_view()), name='admin_profile_picture_update'), | ||
path("post/", views.AdminCheckInView.as_view()), | ||
path("register/card/", views.AdminRegisterCardView.as_view()), | ||
path("register/profile/", login_required(views.AdminAPIRegisterProfileView.as_view()), name='admin_api_register_profile'), | ||
path("suggest/", login_required(views.AdminSuggestSkillView.as_view()), name='admin_suggest_skill'), | ||
path("suggest/vote/", login_required(views.AdminAPISuggestSkillVoteView.as_view()), name='admin_api_suggest_skill_vote'), | ||
path("suggest/<int:pk>/delete/", login_required(views.AdminAPISuggestSkillDeleteView.as_view()), name='admin_api_suggest_skill_delete'), | ||
] | ||
|
||
# --- Admin URL patterns (imported in `web/urls.py`) --- | ||
|
||
adminpatterns = [ | ||
path("profile/change/image/", views.AdminProfilePictureUpdateView.as_view(), name='admin_profile_picture_update'), | ||
path("post/", views.AdminCheckInView.as_view(), name='admin_check_in'), | ||
path("register/card/", views.AdminRegisterCardView.as_view(), name='admin_register_card'), | ||
path("suggest/", views.AdminSuggestSkillView.as_view(), name='admin_suggest_skill'), | ||
] | ||
|
||
# --- Admin API URL patterns (imported in `web/urls.py`) --- | ||
|
||
suggest_skill_adminapipatterns = [ | ||
path("vote/", views.AdminAPISuggestSkillVoteView.as_view(), name='admin_api_suggest_skill_vote'), | ||
path("<int:pk>/delete/", views.AdminAPISuggestSkillDeleteView.as_view(), name='admin_api_suggest_skill_delete'), | ||
] | ||
|
||
adminapipatterns = [ | ||
path("register/profile/", views.AdminAPIRegisterProfileView.as_view(), name='admin_api_register_profile'), | ||
path("suggest/", include(suggest_skill_adminapipatterns)), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.