diff --git a/CHANGELOG.md b/CHANGELOG.md index 62922a4ca86b48cc20cebf74097de4f5963c13b4..432b645fdc5a3487b29b8853956673a62697fd3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,3 +12,7 @@ from django.contrib.auth.models import Permission permissions = Permission.objects.filter(codename__startswith='view') permissions.delete() ``` + +## MR 2 + +With the addition of Django Sites, you will need to change the site name in the management interface (sites menu). \ No newline at end of file diff --git a/README.md b/README.md index aaff0787bc68296c4dddc971d5c52dab61bbf37a..cb0270ec8d0ab0beb2444a55028dfc13a7464441 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ What have been done so far in Aube that is not in Re2o : * New login form ; * Drop custom password reset mechanics in favor of Django Contrib Auth ; * Filter interfaces with port opening profile rather than listing all machine per profile ; + * Use Django Contrib Sites to manage different domains ; * More coming soon… ## How to migrate from Re2o to Aube diff --git a/re2o/context_processors.py b/re2o/context_processors.py index f9775f776988fddecf3c682fb53826db7a266d95..8e40bfc13995912d3f1b0d17c0dba97f0f58c304 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -37,9 +37,6 @@ def context_user(request): return { 'request_user': user, 'interfaces': interfaces, - # Must takes a different name because djang.auth.contrib.views.login() - # overrides 'site_name' context variable. - 'name_website': GeneralOption.get_cached_value('site_name'), 'ipv6_enabled': OptionalMachine.get_cached_value('ipv6'), } diff --git a/re2o/locale/fr/LC_MESSAGES/django.po b/re2o/locale/fr/LC_MESSAGES/django.po index 181c9198129101857577e84abe4702e6450dabe3..1ca1e14800033c53c3856cb8c1f0598841a39ab8 100644 --- a/re2o/locale/fr/LC_MESSAGES/django.po +++ b/re2o/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-04-24 09:44+0200\n" +"POT-Creation-Date: 2019-04-24 11:16+0200\n" "PO-Revision-Date: 2018-03-31 16:09+0002\n" "Last-Translator: Laouen Fernet \n" "Language-Team: \n" @@ -60,11 +60,11 @@ msgstr "Vous n'avez pas le droit de voir tous les objets %s." msgid "You don't have the right to view a %s object." msgstr "Vous n'avez pas le droit de voir un objet %s." -#: re2o/settings.py:144 +#: re2o/settings.py:146 msgid "English" msgstr "Anglais" -#: re2o/settings.py:145 +#: re2o/settings.py:147 msgid "French" msgstr "Français" @@ -180,8 +180,8 @@ msgstr "Accueil" #: re2o/templates/re2o/index.html:33 #, python-format -msgid "Welcome to %(name_website)s" -msgstr "Bienvenue sur %(name_website)s" +msgid "Welcome to %(request.site.name)s" +msgstr "Bienvenue sur %(request.site.name)s" #: re2o/templates/re2o/index.html:42 msgid "Registration" diff --git a/re2o/settings.py b/re2o/settings.py index 977ac1d55b946cfe131e200c558cb67b0ae2a99e..e7fd11e0631f633cc98c77a2d6798e6221c1f375 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -48,6 +48,7 @@ DJANGO_CONTRIB_APPS = ( 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.sites', ) EXTERNAL_CONTRIB_APPS = ( 'bootstrap3', @@ -82,6 +83,7 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware', + 'django.contrib.sites.middleware.CurrentSiteMiddleware', 'reversion.middleware.RevisionMiddleware', ) @@ -174,6 +176,9 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/') # The URL to access the static files MEDIA_URL = os.path.join(BASE_DIR,'/media/') +# Django main site +SITE_ID = 1 + # Models to use for graphs GRAPH_MODELS = { 'all_applications': True, diff --git a/re2o/templates/re2o/index.html b/re2o/templates/re2o/index.html index 3baeb1fcdee9d46ddb9ef8148ab19269da9feba7..55c7cc8334a73c3f1d14453307a98d995a111bd1 100644 --- a/re2o/templates/re2o/index.html +++ b/re2o/templates/re2o/index.html @@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}
-

{% blocktrans %}Welcome to {{ name_website }}{% endblocktrans %}

+

{% blocktrans %}Welcome to {{ request.site.name }}{% endblocktrans %}

{% if not request.user.is_authenticated %}
diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html index be2c3d28182ce934eaa5c5e7165d40a3122ce30c..fbe00d195d68bc1e332179b3d246faba48ae365c 100644 --- a/templates/admin/base_site.html +++ b/templates/admin/base_site.html @@ -7,7 +7,7 @@ Copyright © 2019 Alexandre Iooss {% load i18n staticfiles %} -{% block title %}{{ title }} | {{ name_website }}{% endblock %} +{% block title %}{{ title }} | {{ request.site.name }}{% endblock %} {% block branding %}

@@ -15,7 +15,7 @@ Copyright © 2019 Alexandre Iooss - {{ name_website }} + {{ request.site.name }}

{% endblock %} @@ -62,7 +62,7 @@ Copyright © 2019 Alexandre Iooss {% block footer %}