mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-29 11:44:28 +01:00
Bump Django to 2.0 and simplify URL routing syntax
See: https://docs.djangoproject.com/en/stable/releases/2.0/ The only required changes are - as reported in #1466 - the addition of `app_name` in `urls.py` for URL namespaces.
This commit is contained in:
@@ -103,17 +103,15 @@ class ExtensionsPool(object):
|
||||
result = []
|
||||
for ext_name in list(self.extensions.keys()):
|
||||
ext = self.get_extension(ext_name)
|
||||
options = {}
|
||||
if category == "api":
|
||||
root = ""
|
||||
pattern = "{}.urls_api"
|
||||
else:
|
||||
root = r"^{}/".format(ext.get_url())
|
||||
options.update({"namespace": ext_name})
|
||||
pattern = "{}.urls"
|
||||
try:
|
||||
result.append(
|
||||
url(root, include(pattern.format(ext_name), **options))
|
||||
url(root, include(pattern.format(ext_name)))
|
||||
)
|
||||
except ImportError:
|
||||
# No urls for this extension
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.0.13 on 2020-01-04 17:14
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0017_auto_20190705_1045'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='last_name',
|
||||
field=models.CharField(blank=True, max_length=150, verbose_name='last name'),
|
||||
),
|
||||
]
|
||||
+20
-18
@@ -1,28 +1,30 @@
|
||||
"""Core urls."""
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "core"
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.RootDispatchView.as_view(), name="root"),
|
||||
url(r'^dashboard/$', views.DashboardView.as_view(), name="dashboard"),
|
||||
path('', views.RootDispatchView.as_view(), name="root"),
|
||||
path('dashboard/', views.DashboardView.as_view(), name="dashboard"),
|
||||
|
||||
url(r'^accounts/login/$', views.dologin, name="login"),
|
||||
url(r'^accounts/logout/$', views.dologout, name="logout"),
|
||||
path('accounts/login/', views.dologin, name="login"),
|
||||
path('accounts/logout/', views.dologout, name="logout"),
|
||||
|
||||
url(r'^core/$', views.viewsettings, name="index"),
|
||||
url(r'^core/parameters/$', views.parameters, name="parameters"),
|
||||
url(r'^core/info/$', views.information, name="information"),
|
||||
url(r'^core/logs/$', views.logs, name="log_list"),
|
||||
url(r'^core/logs/page/$', views.logs_page, name="logs_page"),
|
||||
url(r'^core/top_notifications/check/$',
|
||||
views.check_top_notifications,
|
||||
name="top_notifications_check"),
|
||||
path('core/', views.viewsettings, name="index"),
|
||||
path('core/parameters/', views.parameters, name="parameters"),
|
||||
path('core/info/', views.information, name="information"),
|
||||
path('core/logs/', views.logs, name="log_list"),
|
||||
path('core/logs/page/', views.logs_page, name="logs_page"),
|
||||
path('core/top_notifications/check/',
|
||||
views.check_top_notifications,
|
||||
name="top_notifications_check"),
|
||||
|
||||
url(r'^user/$', views.index, name="user_index"),
|
||||
url(r'^user/preferences/$', views.preferences,
|
||||
name="user_preferences"),
|
||||
url(r'^user/profile/$', views.profile, name="user_profile"),
|
||||
url(r'^user/api/$', views.api_access, name="user_api_access"),
|
||||
path('user/', views.index, name="user_index"),
|
||||
path('user/preferences/', views.preferences,
|
||||
name="user_preferences"),
|
||||
path('user/profile/', views.profile, name="user_profile"),
|
||||
path('user/api/', views.api_access, name="user_api_access"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user