diff --git a/mayan/apps/common/__init__.py b/mayan/apps/common/__init__.py index 01b7ad6bf7..a3db11709a 100644 --- a/mayan/apps/common/__init__.py +++ b/mayan/apps/common/__init__.py @@ -24,8 +24,8 @@ from .utils import validate_path logger = logging.getLogger(__name__) -register_links(['current_user_details', 'current_user_edit', 'password_change_view'], [link_current_user_details, link_current_user_edit, link_password_change], menu_name='secondary_menu') -register_links(['about_view', 'license_view', 'form_view'], [link_about, link_license], menu_name='secondary_menu') +register_links(['common:current_user_details', 'common:current_user_edit', 'common:password_change_view'], [link_current_user_details, link_current_user_edit, link_password_change], menu_name='secondary_menu') +register_links(['common:about_view', 'common:license_view', 'registration:form_view'], [link_about, link_license], menu_name='secondary_menu') register_top_menu('about', link_about, position=-1) diff --git a/mayan/apps/common/links.py b/mayan/apps/common/links.py index 94e2913e0b..dda8088758 100644 --- a/mayan/apps/common/links.py +++ b/mayan/apps/common/links.py @@ -7,9 +7,9 @@ def has_usable_password(context): return context['request'].user.has_usable_password -link_password_change = {'text': _(u'change password'), 'view': 'password_change_view', 'famfam': 'computer_key', 'condition': has_usable_password} -link_current_user_details = {'text': _(u'user details'), 'view': 'current_user_details', 'famfam': 'vcard'} -link_current_user_edit = {'text': _(u'edit details'), 'view': 'current_user_edit', 'famfam': 'vcard_edit'} +link_password_change = {'text': _(u'change password'), 'view': 'common:password_change_view', 'famfam': 'computer_key', 'condition': has_usable_password} +link_current_user_details = {'text': _(u'user details'), 'view': 'common:current_user_details', 'famfam': 'vcard'} +link_current_user_edit = {'text': _(u'edit details'), 'view': 'common:current_user_edit', 'famfam': 'vcard_edit'} -link_about = {'text': _(u'about'), 'view': 'about_view', 'famfam': 'information'} -link_license = {'text': _(u'license'), 'view': 'license_view', 'famfam': 'script'} +link_about = {'text': _(u'about'), 'view': 'common:about_view', 'famfam': 'information'} +link_license = {'text': _(u'license'), 'view': 'common:license_view', 'famfam': 'script'} diff --git a/mayan/apps/common/middleware/login_required_middleware.py b/mayan/apps/common/middleware/login_required_middleware.py index 94331d32aa..d36e337f6d 100644 --- a/mayan/apps/common/middleware/login_required_middleware.py +++ b/mayan/apps/common/middleware/login_required_middleware.py @@ -4,10 +4,11 @@ import re from django.http import HttpResponseRedirect from django.conf import settings +from django.core.urlresolvers import reverse from ..conf.settings import ALLOW_ANONYMOUS_ACCESS -EXEMPT_URLS = [re.compile(settings.LOGIN_URL.lstrip('/'))] +EXEMPT_URLS = [re.compile(reverse(settings.LOGIN_URL).lstrip('/'))] if hasattr(settings, 'LOGIN_EXEMPT_URLS'): EXEMPT_URLS += [re.compile(expr) for expr in settings.LOGIN_EXEMPT_URLS] @@ -34,4 +35,4 @@ class LoginRequiredMiddleware: if not request.user.is_authenticated(): path = request.path_info.lstrip('/') if not any(m.match(path) for m in EXEMPT_URLS): - return HttpResponseRedirect(settings.LOGIN_URL) + return HttpResponseRedirect(reverse(settings.LOGIN_URL)) diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py index cf587c526d..d34089e3ed 100644 --- a/mayan/apps/common/views.py +++ b/mayan/apps/common/views.py @@ -181,7 +181,7 @@ def current_user_edit(request): Allow an user to edit his own details """ - next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', reverse('current_user_details')))) + next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', reverse('common:current_user_details')))) if request.method == 'POST': form = UserForm(instance=request.user, data=request.POST) @@ -245,7 +245,7 @@ def password_change_view(request): request, extra_context=context, template_name='main/password_change_form.html', - post_change_redirect=reverse('password_change_done'), + post_change_redirect=reverse('common:password_change_done'), ) diff --git a/mayan/apps/main/__init__.py b/mayan/apps/main/__init__.py index 99dcf524a2..3cf6af8f27 100644 --- a/mayan/apps/main/__init__.py +++ b/mayan/apps/main/__init__.py @@ -11,7 +11,7 @@ from .conf.settings import DISABLE_HOME_VIEW from .links import admin_site, diagnostics, maintenance_menu, sentry if not DISABLE_HOME_VIEW: - register_top_menu('home', link={'text': _(u'home'), 'view': 'home', 'famfam': 'house'}, position=0) + register_top_menu('home', link={'text': _(u'home'), 'view': 'main:home', 'famfam': 'house'}, position=0) if 'django.contrib.admin' in settings.INSTALLED_APPS: register_setup(admin_site) diff --git a/mayan/apps/main/links.py b/mayan/apps/main/links.py index e21cb71386..aea406bf0d 100644 --- a/mayan/apps/main/links.py +++ b/mayan/apps/main/links.py @@ -5,7 +5,7 @@ def is_superuser(context): return context['request'].user.is_staff or context['request'].user.is_superuser -maintenance_menu = {'text': _(u'maintenance'), 'view': 'maintenance_menu', 'famfam': 'wrench', 'icon': 'wrench.png'} -diagnostics = {'text': _(u'diagnostics'), 'view': 'diagnostics', 'famfam': 'pill', 'icon': 'pill.png'} -sentry = {'text': _(u'sentry'), 'view': 'sentry', 'famfam': 'bug', 'icon': 'bug.png', 'condition': is_superuser} +maintenance_menu = {'text': _(u'maintenance'), 'view': 'main:maintenance_menu', 'famfam': 'wrench', 'icon': 'wrench.png'} +diagnostics = {'text': _(u'diagnostics'), 'view': 'main:diagnostics', 'famfam': 'pill', 'icon': 'pill.png'} +sentry = {'text': _(u'sentry'), 'view': 'main:sentry', 'famfam': 'bug', 'icon': 'bug.png', 'condition': is_superuser} admin_site = {'text': _(u'admin site'), 'view': 'admin:index', 'famfam': 'keyboard', 'icon': 'keyboard.png', 'condition': is_superuser} diff --git a/mayan/apps/main/templates/main/base.html b/mayan/apps/main/templates/main/base.html index 7f91c4ff4b..2e4fb61895 100644 --- a/mayan/apps/main/templates/main/base.html +++ b/mayan/apps/main/templates/main/base.html @@ -148,7 +148,7 @@ {% else %} {% if not web_theme_hide_menus %}