Moved navigation code to its own app
This commit is contained in:
@@ -8,17 +8,6 @@ from django.template.defaultfilters import capfirst
|
||||
from common.utils import return_attrib
|
||||
|
||||
|
||||
class MultiItemForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
actions = kwargs.pop('actions', [])
|
||||
super(MultiItemForm, self).__init__(*args, **kwargs)
|
||||
choices = [('', '------')]
|
||||
choices.extend([(action[0], capfirst(action[1])) for action in actions])
|
||||
self.fields['action'].choices = choices
|
||||
|
||||
action = forms.ChoiceField(label=_(u'Multi item action'))
|
||||
|
||||
|
||||
class DetailSelectMultiple(forms.widgets.SelectMultiple):
|
||||
def __init__(self, queryset=None, *args, **kwargs):
|
||||
self.queryset=queryset
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load navigation %}
|
||||
{% load navigation_tags %}
|
||||
{% block title %} :: {% blocktrans %}List of {{ title }}{% endblocktrans %}{% endblock %}
|
||||
{#{% block secondary_links %}{{ secondary_links|safe }}{% endblock %}#}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% load attribute_tags %}
|
||||
{% load pagination_tags %}
|
||||
{% load navigation %}
|
||||
{% load navigation_tags %}
|
||||
{% load non_breakable %}
|
||||
|
||||
{% if side_bar %}
|
||||
|
||||
@@ -3,7 +3,7 @@ from django.template.defaultfilters import stringfilter
|
||||
from django.template import Library, Node, Variable, VariableDoesNotExist
|
||||
|
||||
from common.utils import return_attrib
|
||||
from common.api import model_list_columns
|
||||
from navigation.api import model_list_columns
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import tempfile
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from common.api import register_links, register_menu, \
|
||||
from navigation.api import register_links, register_menu, \
|
||||
register_model_list_columns, register_multi_item_links
|
||||
from common.utils import pretty_size
|
||||
from common.conf import settings as common_settings
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.api import register_menu
|
||||
from navigation.api import register_menu
|
||||
|
||||
#from permissions import role_list
|
||||
#TODO: Disabled until issue #4 is fixed
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "web_theme_base.html" %}
|
||||
{% load i18n %}
|
||||
{% load project_tags %}
|
||||
{% load navigation %}
|
||||
{% load navigation_tags %}
|
||||
{% load settings %}
|
||||
{% load search_tags %}
|
||||
{% load main_settings_tags %}
|
||||
|
||||
0
apps/navigation/__init__.py
Normal file
0
apps/navigation/__init__.py
Normal file
13
apps/navigation/forms.py
Normal file
13
apps/navigation/forms.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
||||
class MultiItemForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
actions = kwargs.pop('actions', [])
|
||||
super(MultiItemForm, self).__init__(*args, **kwargs)
|
||||
choices = [('', '------')]
|
||||
choices.extend([(action[0], capfirst(action[1])) for action in actions])
|
||||
self.fields['action'].choices = choices
|
||||
|
||||
action = forms.ChoiceField(label=_(u'Multi item action'))
|
||||
3
apps/navigation/models.py
Normal file
3
apps/navigation/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
0
apps/navigation/templatetags/__init__.py
Normal file
0
apps/navigation/templatetags/__init__.py
Normal file
@@ -10,9 +10,9 @@ from django.template import TemplateSyntaxError, Library, \
|
||||
from django.utils.text import unescape_string_literal
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from common.api import object_navigation, multi_object_navigation, \
|
||||
from navigation.api import object_navigation, multi_object_navigation, \
|
||||
menu_links as menu_navigation
|
||||
from common.forms import MultiItemForm
|
||||
from navigation.forms import MultiItemForm
|
||||
|
||||
register = Library()
|
||||
|
||||
23
apps/navigation/tests.py
Normal file
23
apps/navigation/tests.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.failUnlessEqual(1 + 1, 2)
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
1
apps/navigation/views.py
Normal file
1
apps/navigation/views.py
Normal file
@@ -0,0 +1 @@
|
||||
# Create your views here.
|
||||
@@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext
|
||||
from django.db.utils import DatabaseError
|
||||
|
||||
from common.api import register_links, register_menu, register_multi_item_links
|
||||
from navigation.api import register_links, register_menu, register_multi_item_links
|
||||
from permissions.api import register_permissions
|
||||
|
||||
from documents.models import Document
|
||||
|
||||
@@ -3,7 +3,7 @@ from django.db.models.signals import post_save
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.api import register_links, register_menu, \
|
||||
from navigation.api import register_links, register_menu, \
|
||||
register_model_list_columns
|
||||
|
||||
from permissions.conf.settings import DEFAULT_ROLES
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.template import TemplateSyntaxError, Library, \
|
||||
VariableDoesNotExist, Node, Variable
|
||||
from django.utils.text import unescape_string_literal
|
||||
|
||||
#from common.api import object_navigation
|
||||
from web_theme.conf import settings as web_theme_settings
|
||||
|
||||
register = Library()
|
||||
|
||||
@@ -119,6 +119,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.admindocs',
|
||||
'navigation',
|
||||
'web_theme',
|
||||
'main',
|
||||
'common',
|
||||
|
||||
Reference in New Issue
Block a user