diff --git a/src/admin/views.py b/src/admin/views.py index 94c6a408..a9e58800 100644 --- a/src/admin/views.py +++ b/src/admin/views.py @@ -1,9 +1,14 @@ from django.conf import settings from django_hosts.resolvers import reverse_host -from django.http import HttpResponseRedirect +from django.http import HttpResponseRedirect, HttpResponseNotAllowed def redirect_admin(request, path): + if request.method != 'GET': + return HttpResponseNotAllowed(['GET']) + elif request.headers.get('Accept') == 'application/json': + return HttpResponseNotAllowed(['GET']) + protocol = 'https' if request.is_secure() else 'http' host = reverse_host(host='admin') if getattr(settings, 'HOST_PORT', None): diff --git a/src/events/urls.py b/src/events/urls.py index b730b2c6..5b37e416 100644 --- a/src/events/urls.py +++ b/src/events/urls.py @@ -11,22 +11,22 @@ name="my-ticket" ), re_path( - r'^admin/events/event/assign/(\d+)/$', + r'^events/event/assign/(\d+)/$', views.admin_assign, name='events_event_modeladmin_assign_tickets' ), re_path( - r'^admin/events/event/unassign_unpaid/(\d+)/$', + r'^events/event/unassign_unpaid/(\d+)/$', views.admin_unassign_unpaid, name='events_event_modeladmin_unassign_unpaid_tickets' ), re_path( - r'^admin/events/event/remove_applications/(\d+)/$', + r'^events/event/remove_applications/(\d+)/$', views.admin_remove_applications, name='events_event_modeladmin_remove_applications' ), re_path( - r'^admin/events/event/export_participants/(\d+)/$', + r'^events/event/export_participants/(\d+)/$', views.admin_export_participants, name='events_event_modeladmin_export_participants' ), diff --git a/src/involvement/urls.py b/src/involvement/urls.py index 7de575a5..ba510331 100644 --- a/src/involvement/urls.py +++ b/src/involvement/urls.py @@ -4,17 +4,17 @@ urlpatterns = [ re_path( - r'^admin/involvement/position/elect/(\d+)/$', + r'^involvement/position/elect/(\d+)/$', views.admin_approve_applicants, name='involvement_position_modeladmin_approve' ), re_path( - r'^admin/involvement/position/appoint/(\d+)/$', + r'^involvement/position/appoint/(\d+)/$', views.admin_appoint, name='involvement_position_modeladmin_appoint' ), re_path( - r'^admin/involvement/position/extend/(\d+)/$', + r'^involvement/position/extend/(\d+)/$', views.admin_extend_deadline, name='involvement_position_extend' ),