Fix references to 'url'

Change to 're_path'
This commit is contained in:
Martin Whitehouse 2022-06-20 14:39:04 +02:00
parent e613c2107f
commit e438f6b4db
No known key found for this signature in database
GPG Key ID: 8492A7A45769CD35

View File

@ -43,251 +43,192 @@ class DirectTemplateView(TemplateView):
return context 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 = [ urlpatterns = [
path('dashboard/', path("dashboard/", staff.dashboard, name="dashboard"),
staff.dashboard, path("tickets/", staff.ticket_list, name="list"),
name='dashboard'), path("tickets/update/", staff.mass_update, name="mass_update"),
path("tickets/merge", staff.merge_tickets, name="merge_tickets"),
path('tickets/', path("tickets/<int:ticket_id>/", staff.view_ticket, name="view"),
staff.ticket_list, path(
name='list'), "tickets/<int:ticket_id>/followup_edit/<int:followup_id>/",
path('tickets/update/',
staff.mass_update,
name='mass_update'),
path('tickets/merge',
staff.merge_tickets,
name='merge_tickets'),
path('tickets/<int:ticket_id>/',
staff.view_ticket,
name='view'),
path('tickets/<int:ticket_id>/followup_edit/<int:followup_id>/',
staff.followup_edit, staff.followup_edit,
name='followup_edit'), name="followup_edit",
),
path('tickets/<int:ticket_id>/followup_delete/<int:followup_id>/', path(
"tickets/<int:ticket_id>/followup_delete/<int:followup_id>/",
staff.followup_delete, staff.followup_delete,
name='followup_delete'), name="followup_delete",
),
path('tickets/<int:ticket_id>/edit/', path("tickets/<int:ticket_id>/edit/", staff.edit_ticket, name="edit"),
staff.edit_ticket, path("tickets/<int:ticket_id>/update/", staff.update_ticket, name="update"),
name='edit'), path("tickets/<int:ticket_id>/delete/", staff.delete_ticket, name="delete"),
path("tickets/<int:ticket_id>/hold/", staff.hold_ticket, name="hold"),
path('tickets/<int:ticket_id>/update/', path("tickets/<int:ticket_id>/unhold/", staff.unhold_ticket, name="unhold"),
staff.update_ticket, path("tickets/<int:ticket_id>/cc/", staff.ticket_cc, name="ticket_cc"),
name='update'), path("tickets/<int:ticket_id>/cc/add/", staff.ticket_cc_add, name="ticket_cc_add"),
path(
path('tickets/<int:ticket_id>/delete/', "tickets/<int:ticket_id>/cc/delete/<int:cc_id>/",
staff.delete_ticket,
name='delete'),
path('tickets/<int:ticket_id>/hold/',
staff.hold_ticket,
name='hold'),
path('tickets/<int:ticket_id>/unhold/',
staff.unhold_ticket,
name='unhold'),
path('tickets/<int:ticket_id>/cc/',
staff.ticket_cc,
name='ticket_cc'),
path('tickets/<int:ticket_id>/cc/add/',
staff.ticket_cc_add,
name='ticket_cc_add'),
path('tickets/<int:ticket_id>/cc/delete/<int:cc_id>/',
staff.ticket_cc_del, staff.ticket_cc_del,
name='ticket_cc_del'), name="ticket_cc_del",
),
path('tickets/<int:ticket_id>/dependency/add/', path(
"tickets/<int:ticket_id>/dependency/add/",
staff.ticket_dependency_add, staff.ticket_dependency_add,
name='ticket_dependency_add'), name="ticket_dependency_add",
),
path('tickets/<int:ticket_id>/dependency/delete/<int:dependency_id>/', path(
"tickets/<int:ticket_id>/dependency/delete/<int:dependency_id>/",
staff.ticket_dependency_del, staff.ticket_dependency_del,
name='ticket_dependency_del'), name="ticket_dependency_del",
),
path('tickets/<int:ticket_id>/attachment_delete/<int:attachment_id>/', path(
"tickets/<int:ticket_id>/attachment_delete/<int:attachment_id>/",
staff.attachment_del, staff.attachment_del,
name='attachment_del'), name="attachment_del",
),
re_path(r'^raw/(?P<type>\w+)/$', re_path(r"^raw/(?P<type>\w+)/$", staff.raw_details, name="raw"),
staff.raw_details, path("rss/", staff.rss_list, name="rss_index"),
name='raw'), path("reports/", staff.report_index, name="report_index"),
re_path(r"^reports/(?P<report>\w+)/$", staff.run_report, name="run_report"),
path('rss/', path("save_query/", staff.save_query, name="savequery"),
staff.rss_list, path("delete_query/<int:id>/", staff.delete_saved_query, name="delete_query"),
name='rss_index'), path("settings/", staff.EditUserSettingsView.as_view(), name="user_settings"),
path("ignore/", staff.email_ignore, name="email_ignore"),
path('reports/', path("ignore/add/", staff.email_ignore_add, name="email_ignore_add"),
staff.report_index, path("ignore/delete/<int:id>/", staff.email_ignore_del, name="email_ignore_del"),
name='report_index'), re_path(
r"^datatables_ticket_list/(?P<query>{})$".format(base64_pattern),
re_path(r'^reports/(?P<report>\w+)/$',
staff.run_report,
name='run_report'),
path('save_query/',
staff.save_query,
name='savequery'),
path('delete_query/<int:id>/',
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/<int:id>/',
staff.email_ignore_del,
name='email_ignore_del'),
re_path(r'^datatables_ticket_list/(?P<query>{})$'.format(base64_pattern),
staff.datatables_ticket_list, staff.datatables_ticket_list,
name="datatables_ticket_list"), name="datatables_ticket_list",
),
re_path(r'^timeline_ticket_list/(?P<query>{})$'.format(base64_pattern), re_path(
r"^timeline_ticket_list/(?P<query>{})$".format(base64_pattern),
staff.timeline_ticket_list, staff.timeline_ticket_list,
name="timeline_ticket_list"), name="timeline_ticket_list",
),
] ]
if helpdesk_settings.HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET: if helpdesk_settings.HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET:
urlpatterns += [ urlpatterns += [
url(r'^tickets/(?P<ticket_id>[0-9]+)/dependency/add/$', re_path(
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/add/$",
staff.ticket_dependency_add, staff.ticket_dependency_add,
name='ticket_dependency_add'), name="ticket_dependency_add",
),
url(r'^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$', re_path(
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$",
staff.ticket_dependency_del, staff.ticket_dependency_del,
name='ticket_dependency_del'), name="ticket_dependency_del",
),
] ]
urlpatterns += [ urlpatterns += [
path('', path("", protect_view(public.Homepage.as_view()), name="home"),
protect_view(public.Homepage.as_view()), path("tickets/submit/", public.create_ticket, name="submit"),
name='home'), path(
"tickets/submit_iframe/",
path('tickets/submit/',
public.create_ticket,
name='submit'),
path('tickets/submit_iframe/',
public.CreateTicketIframeView.as_view(), public.CreateTicketIframeView.as_view(),
name='submit_iframe'), name="submit_iframe",
),
path('tickets/success_iframe/', # Ticket was submitted successfully path(
"tickets/success_iframe/", # Ticket was submitted successfully
public.SuccessIframeView.as_view(), public.SuccessIframeView.as_view(),
name='success_iframe'), name="success_iframe",
),
path('view/', path("view/", public.view_ticket, name="public_view"),
public.view_ticket, path("change_language/", public.change_language, name="public_change_language"),
name='public_view'),
path('change_language/',
public.change_language,
name='public_change_language'),
] ]
urlpatterns += [ urlpatterns += [
path('rss/user/<str:user_name>/', path(
"rss/user/<str:user_name>/",
helpdesk_staff_member_required(feeds.OpenTicketsByUser()), helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
name='rss_user'), name="rss_user",
),
re_path(r'^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$', re_path(
r"^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$",
helpdesk_staff_member_required(feeds.OpenTicketsByUser()), helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
name='rss_user_queue'), name="rss_user_queue",
),
re_path(r'^rss/queue/(?P<queue_slug>[A-Za-z0-9_-]+)/$', re_path(
r"^rss/queue/(?P<queue_slug>[A-Za-z0-9_-]+)/$",
helpdesk_staff_member_required(feeds.OpenTicketsByQueue()), helpdesk_staff_member_required(feeds.OpenTicketsByQueue()),
name='rss_queue'), name="rss_queue",
),
path('rss/unassigned/', path(
"rss/unassigned/",
helpdesk_staff_member_required(feeds.UnassignedTickets()), helpdesk_staff_member_required(feeds.UnassignedTickets()),
name='rss_unassigned'), name="rss_unassigned",
),
path('rss/recent_activity/', path(
"rss/recent_activity/",
helpdesk_staff_member_required(feeds.RecentFollowUps()), 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) # API is added to url conf based on the setting (False by default)
if helpdesk_settings.HELPDESK_ACTIVATE_API_ENDPOINT: if helpdesk_settings.HELPDESK_ACTIVATE_API_ENDPOINT:
router = DefaultRouter() router = DefaultRouter()
router.register(r'tickets', TicketViewSet, basename='ticket') router.register(r"tickets", TicketViewSet, basename="ticket")
router.register(r'users', CreateUserView, basename='user') router.register(r"users", CreateUserView, basename="user")
urlpatterns += [ urlpatterns += [re_path(r"^api/", include(router.urls))]
url(r'^api/', include(router.urls))
]
urlpatterns += [ urlpatterns += [
path('login/', path("login/", login.login, name="login"),
login.login, path(
name='login'), "logout/",
path('logout/',
auth_views.LogoutView.as_view( auth_views.LogoutView.as_view(
template_name='helpdesk/registration/login.html', template_name="helpdesk/registration/login.html", next_page="../"
next_page='../'), ),
name='logout'), name="logout",
),
path('password_change/', path(
"password_change/",
auth_views.PasswordChangeView.as_view( auth_views.PasswordChangeView.as_view(
template_name='helpdesk/registration/change_password.html', template_name="helpdesk/registration/change_password.html",
success_url='./done'), success_url="./done",
name='password_change'), ),
name="password_change",
path('password_change/done', ),
path(
"password_change/done",
auth_views.PasswordChangeDoneView.as_view( auth_views.PasswordChangeDoneView.as_view(
template_name='helpdesk/registration/change_password_done.html',), template_name="helpdesk/registration/change_password_done.html",
name='password_change_done'), ),
name="password_change_done",
),
] ]
if helpdesk_settings.HELPDESK_KB_ENABLED: if helpdesk_settings.HELPDESK_KB_ENABLED:
urlpatterns += [ urlpatterns += [
path('kb/', path("kb/", kb.index, name="kb_index"),
kb.index, re_path(r"^kb/(?P<slug>[A-Za-z0-9_-]+)/$", kb.category, name="kb_category"),
name='kb_index'), path("kb/<int:item>/vote/", kb.vote, name="kb_vote"),
re_path(
re_path(r'^kb/(?P<slug>[A-Za-z0-9_-]+)/$', r"^kb_iframe/(?P<slug>[A-Za-z0-9_-]+)/$",
kb.category,
name='kb_category'),
path('kb/<int:item>/vote/',
kb.vote,
name='kb_vote'),
re_path(r'^kb_iframe/(?P<slug>[A-Za-z0-9_-]+)/$',
kb.category_iframe, kb.category_iframe,
name='kb_category_iframe'), name="kb_category_iframe",
),
] ]
urlpatterns += [ urlpatterns += [
path('help/context/', path(
TemplateView.as_view(template_name='helpdesk/help_context.html'), "help/context/",
name='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')), path(
name='system_settings'), "system_settings/",
login_required(
DirectTemplateView.as_view(template_name="helpdesk/system_settings.html")
),
name="system_settings",
),
] ]