Change how the HOME_VIEW setting is defined

HOME_VIEW is now COMMON_HOME_VIEW.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-11 22:00:33 -04:00
parent 4c8e647415
commit 4d91d82515
8 changed files with 26 additions and 14 deletions

View File

@@ -15,6 +15,7 @@
* Remove catch all exception handling for the check in and
check out views.
* Improve checkouts tests code reducing redundant code.
* Change how the HOME_VIEW setting is defined.
3.1.11 (2019-04-XX)
===================

View File

@@ -27,6 +27,10 @@ Other changes
* Fix multiple tag selection wizard step.
* Split document app models into separate modules.
* Split workflow views into separate modules.
* Change how the HOME_VIEW setting is defined
HOME_VIEW is now COMMON_HOME_VIEW.
Removals
--------

View File

@@ -16,7 +16,9 @@ from django.utils.translation import ugettext_lazy as _
from stronghold.decorators import public
import mayan
from mayan.apps.common.settings import setting_project_title, setting_project_url
from mayan.apps.common.settings import (
setting_home_view, setting_project_title, setting_project_url
)
from .forms import EmailAuthenticationForm, UsernameAuthenticationForm
from .settings import setting_login_method, setting_maximum_session_length
@@ -84,7 +86,7 @@ def password_change_view(request):
'Changing the password is not allowed for this account.'
)
)
return HttpResponseRedirect(reverse(settings.HOME_VIEW))
return HttpResponseRedirect(reverse(setting_home_view.view))
return password_change(
request, extra_context=extra_context,

View File

@@ -3,7 +3,6 @@ from __future__ import unicode_literals
import hashlib
from django.apps import apps
from django.conf import settings
from django.db import models
from django.template import loader
from django.template.response import TemplateResponse
@@ -11,6 +10,8 @@ from django.urls import reverse
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext
from .settings import setting_home_view
@python_2_unicode_compatible
class Collection(object):
@@ -397,7 +398,7 @@ class Template(object):
def render(self, request):
context = {
'home_view': settings.HOME_VIEW,
'home_view': setting_home_view.value,
}
result = TemplateResponse(
request=request,

View File

@@ -2,6 +2,7 @@ from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
DEFAULT_COMMON_HOME_VIEW = 'common:home'
DELETE_STALE_UPLOADS_INTERVAL = 60 * 10 # 10 minutes
DJANGO_SQLITE_BACKEND = 'django.db.backends.sqlite3'
MAYAN_PYPI_NAME = 'mayan-edms'

View File

@@ -9,6 +9,9 @@ from django.utils.translation import ugettext_lazy as _
import mayan
from mayan.apps.smart_settings import Namespace
from .literals import DEFAULT_COMMON_HOME_VIEW
namespace = Namespace(name='common', label=_('Common'))
setting_auto_logging = namespace.add_setting(
@@ -24,6 +27,14 @@ settings_db_sync_task_delay = namespace.add_setting(
'propagate.'
)
)
setting_home_view = namespace.add_setting(
global_name='COMMON_HOME_VIEW',
default=DEFAULT_COMMON_HOME_VIEW, help_text=_(
'Name of the view attached to the branch anchor in the main menu. '
'This is also the view to which users will be redirected after '
'log in.'
),
)
setting_paginate_by = namespace.add_setting(
global_name='COMMON_PAGINATE_BY',
default=40,
@@ -234,14 +245,6 @@ setting_django_file_upload_max_memory_size = namespace.add_setting(
'DATA_UPLOAD_MAX_MEMORY_SIZE.'
),
)
# Not really a Django setting, but since it is flat and defined in setting.py
# We need to put it here.
setting_home_view = namespace.add_setting(
global_name='HOME_VIEW',
default=settings.HOME_VIEW, help_text=_(
'Name of the view attached to the branch anchor in the main menu.'
),
)
setting_django_installed_apps = namespace.add_setting(
global_name='INSTALLED_APPS',
default=settings.INSTALLED_APPS,

View File

@@ -32,6 +32,7 @@ from .generics import ( # NOQA
from .icons import icon_setup
from .menus import menu_tools, menu_setup
from .permissions_runtime import permission_error_log_view
from .settings import setting_home_view
from .utils import check_version
@@ -243,7 +244,7 @@ class PackagesLicensesView(SimpleView):
class RootView(SimpleView):
extra_context = {'home_view': settings.HOME_VIEW}
extra_context = {'home_view': setting_home_view.value}
template_name = 'appearance/root.html'

View File

@@ -250,7 +250,6 @@ TEST_RUNNER = 'mayan.apps.common.tests.runner.MayanTestRunner'
# --------- Django -------------------
HOME_VIEW = env('MAYAN_HOME_VIEW', default='common:home')
LOGIN_URL = env('MAYAN_LOGIN_URL', default='authentication:login_view')
LOGIN_REDIRECT_URL = env('MAYAN_LOGIN_REDIRECT_URL', default='common:root')
INTERNAL_IPS = ('127.0.0.1',)