Move common app links to a seprate file
This commit is contained in:
@@ -14,16 +14,8 @@ from .conf.settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME,
|
||||
AUTO_ADMIN_PASSWORD, TEMPORARY_DIRECTORY)
|
||||
from .conf import settings as common_settings
|
||||
from .utils import validate_path
|
||||
|
||||
|
||||
def has_usable_password(context):
|
||||
return context['request'].user.has_usable_password
|
||||
|
||||
password_change_view = Link(text=_(u'change password'), view='password_change_view', sprite='computer_key', condition=has_usable_password)
|
||||
current_user_details = Link(text=_(u'user details'), view='current_user_details', sprite='vcard')
|
||||
current_user_edit = Link(text=_(u'edit details'), view='current_user_edit', sprite='vcard_edit')
|
||||
about_view = Link(text=_('about'), view='about_view', sprite='information')
|
||||
license_view = Link(text=_('license'), view='license_view', sprite='script')
|
||||
from .links import (password_change_view, current_user_details,
|
||||
current_user_edit, about_view, license_view)
|
||||
|
||||
bind_links(['about_view', 'license_view'], [about_view, license_view], menu_name='secondary_menu')
|
||||
bind_links(['current_user_details', 'current_user_edit', 'password_change_view'], [current_user_details, current_user_edit, password_change_view], menu_name='secondary_menu')
|
||||
|
||||
13
apps/common/links.py
Normal file
13
apps/common/links.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation.api import Link
|
||||
|
||||
|
||||
def has_usable_password(context):
|
||||
return context['request'].user.has_usable_password
|
||||
|
||||
password_change_view = Link(text=_(u'change password'), view='password_change_view', sprite='computer_key', condition=has_usable_password)
|
||||
current_user_details = Link(text=_(u'user details'), view='current_user_details', sprite='vcard')
|
||||
current_user_edit = Link(text=_(u'edit details'), view='current_user_edit', sprite='vcard_edit')
|
||||
about_view = Link(text=_('about'), view='about_view', sprite='information')
|
||||
license_view = Link(text=_('license'), view='license_view', sprite='script')
|
||||
Reference in New Issue
Block a user