From e438f6b4db1a9a19cded27dbf05bba0e03cdbc2e Mon Sep 17 00:00:00 2001 From: Martin Whitehouse Date: Mon, 20 Jun 2022 14:39:04 +0200 Subject: [PATCH] Fix references to 'url' Change to 're_path' --- helpdesk/urls.py | 335 +++++++++++++++++++---------------------------- 1 file changed, 138 insertions(+), 197 deletions(-) diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 618bf60b..7e5792e7 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -43,251 +43,192 @@ class DirectTemplateView(TemplateView): return context -app_name = 'helpdesk' +app_name = "helpdesk" -base64_pattern = r'(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$' +base64_pattern = r"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" urlpatterns = [ - path('dashboard/', - staff.dashboard, - name='dashboard'), - - path('tickets/', - staff.ticket_list, - name='list'), - - path('tickets/update/', - staff.mass_update, - name='mass_update'), - - path('tickets/merge', - staff.merge_tickets, - name='merge_tickets'), - - path('tickets//', - staff.view_ticket, - name='view'), - - path('tickets//followup_edit//', + path("dashboard/", staff.dashboard, name="dashboard"), + path("tickets/", staff.ticket_list, name="list"), + path("tickets/update/", staff.mass_update, name="mass_update"), + path("tickets/merge", staff.merge_tickets, name="merge_tickets"), + path("tickets//", staff.view_ticket, name="view"), + path( + "tickets//followup_edit//", staff.followup_edit, - name='followup_edit'), - - path('tickets//followup_delete//', + name="followup_edit", + ), + path( + "tickets//followup_delete//", staff.followup_delete, - name='followup_delete'), - - path('tickets//edit/', - staff.edit_ticket, - name='edit'), - - path('tickets//update/', - staff.update_ticket, - name='update'), - - path('tickets//delete/', - staff.delete_ticket, - name='delete'), - - path('tickets//hold/', - staff.hold_ticket, - name='hold'), - - path('tickets//unhold/', - staff.unhold_ticket, - name='unhold'), - - path('tickets//cc/', - staff.ticket_cc, - name='ticket_cc'), - - path('tickets//cc/add/', - staff.ticket_cc_add, - name='ticket_cc_add'), - - path('tickets//cc/delete//', + name="followup_delete", + ), + path("tickets//edit/", staff.edit_ticket, name="edit"), + path("tickets//update/", staff.update_ticket, name="update"), + path("tickets//delete/", staff.delete_ticket, name="delete"), + path("tickets//hold/", staff.hold_ticket, name="hold"), + path("tickets//unhold/", staff.unhold_ticket, name="unhold"), + path("tickets//cc/", staff.ticket_cc, name="ticket_cc"), + path("tickets//cc/add/", staff.ticket_cc_add, name="ticket_cc_add"), + path( + "tickets//cc/delete//", staff.ticket_cc_del, - name='ticket_cc_del'), - - path('tickets//dependency/add/', + name="ticket_cc_del", + ), + path( + "tickets//dependency/add/", staff.ticket_dependency_add, - name='ticket_dependency_add'), - - path('tickets//dependency/delete//', + name="ticket_dependency_add", + ), + path( + "tickets//dependency/delete//", staff.ticket_dependency_del, - name='ticket_dependency_del'), - - path('tickets//attachment_delete//', + name="ticket_dependency_del", + ), + path( + "tickets//attachment_delete//", staff.attachment_del, - name='attachment_del'), - - re_path(r'^raw/(?P\w+)/$', - staff.raw_details, - name='raw'), - - path('rss/', - staff.rss_list, - name='rss_index'), - - path('reports/', - staff.report_index, - name='report_index'), - - re_path(r'^reports/(?P\w+)/$', - staff.run_report, - name='run_report'), - - path('save_query/', - staff.save_query, - name='savequery'), - - path('delete_query//', - staff.delete_saved_query, - name='delete_query'), - - path('settings/', - staff.EditUserSettingsView.as_view(), - name='user_settings'), - - path('ignore/', - staff.email_ignore, - name='email_ignore'), - - path('ignore/add/', - staff.email_ignore_add, - name='email_ignore_add'), - - path('ignore/delete//', - staff.email_ignore_del, - name='email_ignore_del'), - - re_path(r'^datatables_ticket_list/(?P{})$'.format(base64_pattern), + name="attachment_del", + ), + re_path(r"^raw/(?P\w+)/$", staff.raw_details, name="raw"), + path("rss/", staff.rss_list, name="rss_index"), + path("reports/", staff.report_index, name="report_index"), + re_path(r"^reports/(?P\w+)/$", staff.run_report, name="run_report"), + path("save_query/", staff.save_query, name="savequery"), + path("delete_query//", staff.delete_saved_query, name="delete_query"), + path("settings/", staff.EditUserSettingsView.as_view(), name="user_settings"), + path("ignore/", staff.email_ignore, name="email_ignore"), + path("ignore/add/", staff.email_ignore_add, name="email_ignore_add"), + path("ignore/delete//", staff.email_ignore_del, name="email_ignore_del"), + re_path( + r"^datatables_ticket_list/(?P{})$".format(base64_pattern), staff.datatables_ticket_list, - name="datatables_ticket_list"), - - re_path(r'^timeline_ticket_list/(?P{})$'.format(base64_pattern), + name="datatables_ticket_list", + ), + re_path( + r"^timeline_ticket_list/(?P{})$".format(base64_pattern), staff.timeline_ticket_list, - name="timeline_ticket_list"), - + name="timeline_ticket_list", + ), ] if helpdesk_settings.HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET: urlpatterns += [ - url(r'^tickets/(?P[0-9]+)/dependency/add/$', + re_path( + r"^tickets/(?P[0-9]+)/dependency/add/$", staff.ticket_dependency_add, - name='ticket_dependency_add'), - - url(r'^tickets/(?P[0-9]+)/dependency/delete/(?P[0-9]+)/$', + name="ticket_dependency_add", + ), + re_path( + r"^tickets/(?P[0-9]+)/dependency/delete/(?P[0-9]+)/$", staff.ticket_dependency_del, - name='ticket_dependency_del'), + name="ticket_dependency_del", + ), ] urlpatterns += [ - path('', - protect_view(public.Homepage.as_view()), - name='home'), - - path('tickets/submit/', - public.create_ticket, - name='submit'), - - path('tickets/submit_iframe/', + path("", protect_view(public.Homepage.as_view()), name="home"), + path("tickets/submit/", public.create_ticket, name="submit"), + path( + "tickets/submit_iframe/", public.CreateTicketIframeView.as_view(), - name='submit_iframe'), - - path('tickets/success_iframe/', # Ticket was submitted successfully + name="submit_iframe", + ), + path( + "tickets/success_iframe/", # Ticket was submitted successfully public.SuccessIframeView.as_view(), - name='success_iframe'), - - path('view/', - public.view_ticket, - name='public_view'), - - path('change_language/', - public.change_language, - name='public_change_language'), + name="success_iframe", + ), + path("view/", public.view_ticket, name="public_view"), + path("change_language/", public.change_language, name="public_change_language"), ] urlpatterns += [ - path('rss/user//', + path( + "rss/user//", helpdesk_staff_member_required(feeds.OpenTicketsByUser()), - name='rss_user'), - - re_path(r'^rss/user/(?P[^/]+)/(?P[A-Za-z0-9_-]+)/$', + name="rss_user", + ), + re_path( + r"^rss/user/(?P[^/]+)/(?P[A-Za-z0-9_-]+)/$", helpdesk_staff_member_required(feeds.OpenTicketsByUser()), - name='rss_user_queue'), - - re_path(r'^rss/queue/(?P[A-Za-z0-9_-]+)/$', + name="rss_user_queue", + ), + re_path( + r"^rss/queue/(?P[A-Za-z0-9_-]+)/$", helpdesk_staff_member_required(feeds.OpenTicketsByQueue()), - name='rss_queue'), - - path('rss/unassigned/', + name="rss_queue", + ), + path( + "rss/unassigned/", helpdesk_staff_member_required(feeds.UnassignedTickets()), - name='rss_unassigned'), - - path('rss/recent_activity/', + name="rss_unassigned", + ), + path( + "rss/recent_activity/", helpdesk_staff_member_required(feeds.RecentFollowUps()), - name='rss_activity'), + name="rss_activity", + ), ] # API is added to url conf based on the setting (False by default) if helpdesk_settings.HELPDESK_ACTIVATE_API_ENDPOINT: router = DefaultRouter() - router.register(r'tickets', TicketViewSet, basename='ticket') - router.register(r'users', CreateUserView, basename='user') - urlpatterns += [ - url(r'^api/', include(router.urls)) - ] + router.register(r"tickets", TicketViewSet, basename="ticket") + router.register(r"users", CreateUserView, basename="user") + urlpatterns += [re_path(r"^api/", include(router.urls))] urlpatterns += [ - path('login/', - login.login, - name='login'), - - path('logout/', + path("login/", login.login, name="login"), + path( + "logout/", auth_views.LogoutView.as_view( - template_name='helpdesk/registration/login.html', - next_page='../'), - name='logout'), - - path('password_change/', + template_name="helpdesk/registration/login.html", next_page="../" + ), + name="logout", + ), + path( + "password_change/", auth_views.PasswordChangeView.as_view( - template_name='helpdesk/registration/change_password.html', - success_url='./done'), - name='password_change'), - - path('password_change/done', + template_name="helpdesk/registration/change_password.html", + success_url="./done", + ), + name="password_change", + ), + path( + "password_change/done", auth_views.PasswordChangeDoneView.as_view( - template_name='helpdesk/registration/change_password_done.html',), - name='password_change_done'), + template_name="helpdesk/registration/change_password_done.html", + ), + name="password_change_done", + ), ] if helpdesk_settings.HELPDESK_KB_ENABLED: urlpatterns += [ - path('kb/', - kb.index, - name='kb_index'), - - re_path(r'^kb/(?P[A-Za-z0-9_-]+)/$', - kb.category, - name='kb_category'), - - path('kb//vote/', - kb.vote, - name='kb_vote'), - - re_path(r'^kb_iframe/(?P[A-Za-z0-9_-]+)/$', + path("kb/", kb.index, name="kb_index"), + re_path(r"^kb/(?P[A-Za-z0-9_-]+)/$", kb.category, name="kb_category"), + path("kb//vote/", kb.vote, name="kb_vote"), + re_path( + r"^kb_iframe/(?P[A-Za-z0-9_-]+)/$", kb.category_iframe, - name='kb_category_iframe'), + name="kb_category_iframe", + ), ] urlpatterns += [ - path('help/context/', - TemplateView.as_view(template_name='helpdesk/help_context.html'), - name='help_context'), - - path('system_settings/', - login_required(DirectTemplateView.as_view(template_name='helpdesk/system_settings.html')), - name='system_settings'), + path( + "help/context/", + TemplateView.as_view(template_name="helpdesk/help_context.html"), + name="help_context", + ), + path( + "system_settings/", + login_required( + DirectTemplateView.as_view(template_name="helpdesk/system_settings.html") + ), + name="system_settings", + ), ]