-
Notifications
You must be signed in to change notification settings - Fork 4
/
urls.py
105 lines (89 loc) · 3.57 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# coding=utf-8
from pydoc import locate
import debug_toolbar
from django.conf import settings
from django.urls import include, path
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf.urls.static import static
from django.contrib.auth.decorators import login_required
from core.views import (
contact_api,
contact_exists,
search_contacts_htmx,
mailtrain_list_subscription,
mailtrain_lists,
get_mailtrain_list_subscribed_emails,
toggle_mailtrain_subscription,
create_oneshot_invoice_from_web,
contact_by_emailprefix,
)
from invoicing import api as invoicing_api
# Custom error handlers. These are used to override the default Django error handlers and are defined in the core app.
handler404 = 'core.views.handler404'
handler403 = 'core.views.handler403'
handler500 = 'core.views.handler500'
# Used to add customized url patterns from a custom app, they're declared up here so you can add your own custom apps
# and override existing URLs if you need.
urls_custom_modules = getattr(settings, 'URLS_CUSTOM_MODULE', None)
urlpatterns = locate(urls_custom_modules).urlpatterns if urls_custom_modules else []
# Django admindocs and admin
urlpatterns += [
path('user/', include('django.contrib.auth.urls')),
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin.site.urls),
path('', login_required(TemplateView.as_view(template_name='main_menu.html')), name='main_menu'),
]
# Core views
urlpatterns += [
path("api/existsuserweb/", contact_exists),
path("api/updateuserweb/", contact_api),
path("api/contact_by_emailprefix/", contact_by_emailprefix),
path('api/search_contacts/', search_contacts_htmx, name="htmx_search_contacts"),
path('api/search_contacts/<str:name>/', search_contacts_htmx, name="htmx_search_contacts_alt"),
path('api/mailtrain_list_subscription/', mailtrain_list_subscription, name="mailtrain_list_subscription"),
path('api/mailtrain_lists/', mailtrain_lists, name="mailtrain_lists"),
path("api/mailtrain_subscribers/list/<str:list_id>/", get_mailtrain_list_subscribed_emails),
path(
"mailtrain/toggle_subscription/<int:contact_id>/<str:cid>/",
toggle_mailtrain_subscription,
name="toggle_mailtrain_subscription",
),
path(
"api/create_oneshot_invoice_from_web/", create_oneshot_invoice_from_web, name="create_oneshot_invoice_from_web"
),
]
if 'support' in settings.INSTALLED_APPS:
urlpatterns += [
path('support/', include('support.urls'), name='support_menu'),
]
if 'invoicing' in settings.INSTALLED_APPS:
urlpatterns += [
path('invoicing/', include('invoicing.urls')),
]
# Invocing API
urlpatterns += [
path('api/createinvoicefromweb/', invoicing_api.createinvoicefromweb, name='createinvoicefromweb'),
]
if 'logistics' in settings.INSTALLED_APPS:
urlpatterns += [
path('logistics/', include('logistics.urls')),
]
if 'advertisement' in settings.INSTALLED_APPS:
urlpatterns += [
path('advertisement/', include('advertisement.urls')),
]
# test
urlpatterns += [path('test/', TemplateView.as_view(template_name='tests/index.html'))]
if settings.DEBUG:
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
if getattr(settings, 'SERVE_MEDIA', False):
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
)
# Select2 URLs
urlpatterns += [
path('select2/', include('django_select2.urls')),
]