2008-02-06 05:36:07 +01:00
|
|
|
"""
|
2011-01-26 00:08:41 +01:00
|
|
|
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
2007-12-27 01:29:17 +01:00
|
|
|
|
2008-02-06 05:36:07 +01:00
|
|
|
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
|
2007-12-27 01:29:17 +01:00
|
|
|
|
2008-08-19 10:50:38 +02:00
|
|
|
urls.py - Mapping of URL's to our various views. Note we always used NAMED
|
2008-02-06 05:36:07 +01:00
|
|
|
views for simplicity in linking later on.
|
2007-12-27 01:29:17 +01:00
|
|
|
"""
|
|
|
|
|
2022-03-17 03:29:09 +01:00
|
|
|
from django.urls import path, re_path
|
2008-02-08 06:29:51 +01:00
|
|
|
from django.contrib.auth.decorators import login_required
|
2016-10-21 17:14:12 +02:00
|
|
|
from django.contrib.auth import views as auth_views
|
2022-03-31 17:19:49 +02:00
|
|
|
from django.urls import include
|
2016-10-21 17:14:12 +02:00
|
|
|
from django.views.generic import TemplateView
|
2022-03-31 17:19:49 +02:00
|
|
|
from rest_framework.routers import DefaultRouter
|
2008-02-08 06:29:51 +01:00
|
|
|
|
2018-09-07 19:05:16 +02:00
|
|
|
from helpdesk.decorators import helpdesk_staff_member_required, protect_view
|
2022-03-18 19:21:17 +01:00
|
|
|
from helpdesk.views import feeds, staff, public, login
|
|
|
|
from helpdesk import settings as helpdesk_settings
|
2022-05-02 17:27:25 +02:00
|
|
|
from helpdesk.views.api import TicketViewSet, CreateUserView
|
2022-03-18 19:21:17 +01:00
|
|
|
|
|
|
|
if helpdesk_settings.HELPDESK_KB_ENABLED:
|
|
|
|
from helpdesk.views import kb
|
|
|
|
|
2018-11-07 15:01:41 +01:00
|
|
|
try:
|
2021-03-05 09:27:23 +01:00
|
|
|
# TODO: why is it imported? due to some side-effect or by mistake?
|
|
|
|
import helpdesk.tasks # NOQA
|
2018-11-07 15:01:41 +01:00
|
|
|
except ImportError:
|
|
|
|
pass
|
2008-02-08 06:29:51 +01:00
|
|
|
|
2016-10-21 17:14:12 +02:00
|
|
|
|
2013-03-18 18:57:39 +01:00
|
|
|
class DirectTemplateView(TemplateView):
|
|
|
|
extra_context = None
|
2016-10-21 17:14:12 +02:00
|
|
|
|
2013-03-18 18:57:39 +01:00
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super(self.__class__, self).get_context_data(**kwargs)
|
|
|
|
if self.extra_context is not None:
|
|
|
|
for key, value in self.extra_context.items():
|
|
|
|
if callable(value):
|
|
|
|
context[key] = value()
|
|
|
|
else:
|
|
|
|
context[key] = value
|
|
|
|
return context
|
2011-06-09 17:24:33 +02:00
|
|
|
|
2017-12-06 08:06:07 +01:00
|
|
|
|
2022-06-20 14:39:04 +02:00
|
|
|
app_name = "helpdesk"
|
2015-12-22 10:10:00 +01:00
|
|
|
|
2022-06-20 14:39:04 +02:00
|
|
|
base64_pattern = r"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
|
2019-10-11 15:50:35 +02:00
|
|
|
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns = [
|
2022-06-20 14:39:04 +02:00
|
|
|
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>/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.followup_edit,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="followup_edit",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"tickets/<int:ticket_id>/followup_delete/<int:followup_id>/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.followup_delete,
|
2022-06-20 14:39:04 +02:00
|
|
|
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>/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.ticket_cc_del,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="ticket_cc_del",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"tickets/<int:ticket_id>/dependency/add/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.ticket_dependency_add,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="ticket_dependency_add",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"tickets/<int:ticket_id>/dependency/delete/<int:dependency_id>/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.ticket_dependency_del,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="ticket_dependency_del",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"tickets/<int:ticket_id>/attachment_delete/<int:attachment_id>/",
|
2015-12-10 13:36:24 +01:00
|
|
|
staff.attachment_del,
|
2022-06-20 14:39:04 +02:00
|
|
|
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),
|
2018-10-15 02:23:28 +02:00
|
|
|
staff.datatables_ticket_list,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="datatables_ticket_list",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^timeline_ticket_list/(?P<query>{})$".format(base64_pattern),
|
2019-10-21 19:21:22 +02:00
|
|
|
staff.timeline_ticket_list,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="timeline_ticket_list",
|
|
|
|
),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|
2007-12-27 01:29:17 +01:00
|
|
|
|
2022-04-20 16:44:48 +02:00
|
|
|
if helpdesk_settings.HELPDESK_ENABLE_DEPENDENCIES_ON_TICKET:
|
|
|
|
urlpatterns += [
|
2022-06-20 14:39:04 +02:00
|
|
|
re_path(
|
|
|
|
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/add/$",
|
2022-04-20 16:44:48 +02:00
|
|
|
staff.ticket_dependency_add,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="ticket_dependency_add",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^tickets/(?P<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$",
|
2022-04-20 16:44:48 +02:00
|
|
|
staff.ticket_dependency_del,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="ticket_dependency_del",
|
|
|
|
),
|
2022-04-20 16:44:48 +02:00
|
|
|
]
|
|
|
|
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns += [
|
2022-06-20 14:39:04 +02:00
|
|
|
path("", protect_view(public.Homepage.as_view()), name="home"),
|
|
|
|
path("tickets/submit/", public.create_ticket, name="submit"),
|
|
|
|
path(
|
|
|
|
"tickets/submit_iframe/",
|
2019-12-12 15:22:12 +01:00
|
|
|
public.CreateTicketIframeView.as_view(),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="submit_iframe",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"tickets/success_iframe/", # Ticket was submitted successfully
|
2020-01-14 17:41:55 +01:00
|
|
|
public.SuccessIframeView.as_view(),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="success_iframe",
|
|
|
|
),
|
|
|
|
path("view/", public.view_ticket, name="public_view"),
|
|
|
|
path("change_language/", public.change_language, name="public_change_language"),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|
2008-05-21 23:16:44 +02:00
|
|
|
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns += [
|
2022-06-20 17:26:52 +02:00
|
|
|
re_path(
|
2022-06-20 17:36:40 +02:00
|
|
|
r"^rss/user/(?P<user_name>[a-zA-Z0-9\_\.]+)/",
|
2018-08-21 16:23:25 +02:00
|
|
|
helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="rss_user",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^rss/user/(?P<user_name>[^/]+)/(?P<queue_slug>[A-Za-z0-9_-]+)/$",
|
2018-08-21 16:23:25 +02:00
|
|
|
helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="rss_user_queue",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^rss/queue/(?P<queue_slug>[A-Za-z0-9_-]+)/$",
|
2018-08-21 16:23:25 +02:00
|
|
|
helpdesk_staff_member_required(feeds.OpenTicketsByQueue()),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="rss_queue",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"rss/unassigned/",
|
2018-08-21 16:23:25 +02:00
|
|
|
helpdesk_staff_member_required(feeds.UnassignedTickets()),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="rss_unassigned",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"rss/recent_activity/",
|
2018-08-21 16:23:25 +02:00
|
|
|
helpdesk_staff_member_required(feeds.RecentFollowUps()),
|
2022-06-20 14:39:04 +02:00
|
|
|
name="rss_activity",
|
|
|
|
),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|
2008-08-19 10:50:38 +02:00
|
|
|
|
|
|
|
|
2022-04-15 00:05:51 +02:00
|
|
|
# API is added to url conf based on the setting (False by default)
|
|
|
|
if helpdesk_settings.HELPDESK_ACTIVATE_API_ENDPOINT:
|
|
|
|
router = DefaultRouter()
|
2022-06-20 14:39:04 +02:00
|
|
|
router.register(r"tickets", TicketViewSet, basename="ticket")
|
|
|
|
router.register(r"users", CreateUserView, basename="user")
|
|
|
|
urlpatterns += [re_path(r"^api/", include(router.urls))]
|
2022-03-31 17:19:49 +02:00
|
|
|
|
|
|
|
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns += [
|
2022-06-20 14:39:04 +02:00
|
|
|
path("login/", login.login, name="login"),
|
|
|
|
path(
|
|
|
|
"logout/",
|
2018-08-20 03:59:08 +02:00
|
|
|
auth_views.LogoutView.as_view(
|
2022-06-20 14:39:04 +02:00
|
|
|
template_name="helpdesk/registration/login.html", next_page="../"
|
|
|
|
),
|
|
|
|
name="logout",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"password_change/",
|
2019-03-10 00:38:24 +01:00
|
|
|
auth_views.PasswordChangeView.as_view(
|
2022-06-20 14:39:04 +02:00
|
|
|
template_name="helpdesk/registration/change_password.html",
|
|
|
|
success_url="./done",
|
|
|
|
),
|
|
|
|
name="password_change",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"password_change/done",
|
2019-03-10 00:38:24 +01:00
|
|
|
auth_views.PasswordChangeDoneView.as_view(
|
2022-06-20 14:39:04 +02:00
|
|
|
template_name="helpdesk/registration/change_password_done.html",
|
|
|
|
),
|
|
|
|
name="password_change_done",
|
|
|
|
),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|
2008-05-21 23:16:44 +02:00
|
|
|
|
2011-06-09 17:24:33 +02:00
|
|
|
if helpdesk_settings.HELPDESK_KB_ENABLED:
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns += [
|
2022-06-20 14:39:04 +02:00
|
|
|
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_-]+)/$",
|
2020-01-08 19:36:48 +01:00
|
|
|
kb.category_iframe,
|
2022-06-20 14:39:04 +02:00
|
|
|
name="kb_category_iframe",
|
|
|
|
),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|
2008-08-29 11:11:02 +02:00
|
|
|
|
2015-12-10 13:36:24 +01:00
|
|
|
urlpatterns += [
|
2022-06-20 14:39:04 +02:00
|
|
|
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",
|
|
|
|
),
|
2015-12-10 13:36:24 +01:00
|
|
|
]
|