summaryrefslogtreecommitdiff
path: root/chimere/actions.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/actions.py')
-rw-r--r--chimere/actions.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/chimere/actions.py b/chimere/actions.py
index e83d8c3..9b66492 100644
--- a/chimere/actions.py
+++ b/chimere/actions.py
@@ -21,12 +21,12 @@
Actions available in the main interface
"""
from django.conf import settings
-from django.contrib.auth import models
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugettext_lazy as _
from models import Page
+
class Action:
def __init__(self, id, path, label, extra_url_args=[]):
self.id, self.path, self.label = id, path, label
@@ -34,18 +34,22 @@ class Action:
def update_url(self, area_name):
try:
- self.url = reverse(self.path,
- args=[area_name if area_name else ''] + self.extra_url_args)
+ self.url = reverse(
+ self.path,
+ args=[area_name if area_name else ''] + self.extra_url_args)
except NoReverseMatch:
# backward url management
- self.url = reverse(self.path,
- args=[area_name + '/' if area_name else ''] + self.extra_url_args)
+ self.url = reverse(
+ self.path,
+ args=[area_name + '/' if area_name else '']
+ + self.extra_url_args)
-default_actions = [(Action('view', 'chimere:index', _('View')), []),
- (Action('contribute', 'chimere:edit', _('Contribute')),
- (Action('edit', 'chimere:edit', _('Add a new point of interest')),
- Action('edit-route', 'chimere:editroute', _('Add a new route'))),
- ),]
+default_actions = [
+ (Action('view', 'chimere:index', _('View')), []),
+ (Action('contribute', 'chimere:edit', _('Contribute')),
+ (Action('edit', 'chimere:edit', _('Add a new point of interest')),
+ Action('edit-route', 'chimere:editroute', _('Add a new route'))),
+ )]
if hasattr(settings, 'CHIMERE_DIRECTORY') and settings.CHIMERE_DIRECTORY:
default_actions.append((Action('categories', 'chimere:category-directory',