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
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/<int:ticket_id>/',
staff.view_ticket,
name='view'),
path('tickets/<int:ticket_id>/followup_edit/<int:followup_id>/',
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/<int:ticket_id>/", staff.view_ticket, name="view"),
path(
"tickets/<int:ticket_id>/followup_edit/<int:followup_id>/",
staff.followup_edit,
name='followup_edit'),
path('tickets/<int:ticket_id>/followup_delete/<int:followup_id>/',
name="followup_edit",
),
path(
"tickets/<int:ticket_id>/followup_delete/<int:followup_id>/",
staff.followup_delete,
name='followup_delete'),
path('tickets/<int:ticket_id>/edit/',
staff.edit_ticket,
name='edit'),
path('tickets/<int:ticket_id>/update/',
staff.update_ticket,
name='update'),
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>/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>/',
name="followup_delete",
),
path("tickets/<int:ticket_id>/edit/", staff.edit_ticket, name="edit"),
path("tickets/<int:ticket_id>/update/", staff.update_ticket, name="update"),
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>/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,
name='ticket_cc_del'),
path('tickets/<int:ticket_id>/dependency/add/',
name="ticket_cc_del",
),
path(
"tickets/<int:ticket_id>/dependency/add/",
staff.ticket_dependency_add,
name='ticket_dependency_add'),
path('tickets/<int:ticket_id>/dependency/delete/<int:dependency_id>/',
name="ticket_dependency_add",
),
path(
"tickets/<int:ticket_id>/dependency/delete/<int:dependency_id>/",
staff.ticket_dependency_del,
name='ticket_dependency_del'),
path('tickets/<int:ticket_id>/attachment_delete/<int:attachment_id>/',
name="ticket_dependency_del",
),
path(
"tickets/<int:ticket_id>/attachment_delete/<int:attachment_id>/",
staff.attachment_del,
name='attachment_del'),
re_path(r'^raw/(?P<type>\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<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),
name="attachment_del",
),
re_path(r"^raw/(?P<type>\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<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,
name="datatables_ticket_list"),
re_path(r'^timeline_ticket_list/(?P<query>{})$'.format(base64_pattern),
name="datatables_ticket_list",
),
re_path(
r"^timeline_ticket_list/(?P<query>{})$".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<ticket_id>[0-9]+)/dependency/add/$',
re_path(
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/add/$",
staff.ticket_dependency_add,
name='ticket_dependency_add'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$',
name="ticket_dependency_add",
),
re_path(
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[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/<str:user_name>/',
path(
"rss/user/<str:user_name>/",
helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
name='rss_user'),
re_path(r'^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$',
name="rss_user",
),
re_path(
r"^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$",
helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
name='rss_user_queue'),
re_path(r'^rss/queue/(?P<queue_slug>[A-Za-z0-9_-]+)/$',
name="rss_user_queue",
),
re_path(
r"^rss/queue/(?P<queue_slug>[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<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_-]+)/$',
path("kb/", kb.index, name="kb_index"),
re_path(r"^kb/(?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,
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",
),
]