Skip to content

Commit

Permalink
Merge pull request #44 from makinacorpus/action_history
Browse files Browse the repository at this point in the history
Action history (fixes #2)
  • Loading branch information
leplatrem committed Apr 24, 2014
2 parents a785a6b + 32316bf commit 681f21e
Show file tree
Hide file tree
Showing 21 changed files with 430 additions and 133 deletions.
4 changes: 4 additions & 0 deletions mapentity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
'MAP_CAPTURE_MAX_RATIO': 1.25,
'GEOM_FIELD_NAME': 'geom',
'MAP_BACKGROUND_FOGGED': False,
'ACTION_HISTORY_ENABLED': True,
'ACTION_HISTORY_LENGTH': 20,
'ANONYMOUS_VIEWS_PERMS': tuple(),
'GEOJSON_LAYERS_CACHE_BACKEND': 'default'
}, **getattr(settings, 'MAPENTITY_CONFIG', {}))
Expand Down Expand Up @@ -121,6 +123,7 @@ class Registry(object):
def __init__(self):
self.registry = OrderedDict()
self.apps = {}
self.content_type_ids = []

def register(self, model, name='', menu=True):
""" Register model and returns URL patterns
Expand Down Expand Up @@ -165,6 +168,7 @@ def register(self, model, name='', menu=True):
self.registry[model] = mapentity
post_register.send(sender=self, app_label=app_label, model=model)

self.content_type_ids.append(model.get_content_type_id())
# Returns Django URL patterns
return patterns(name, *view_classes_to_url(*picked))

Expand Down
1 change: 1 addition & 0 deletions mapentity/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ def settings(request):
JS_SETTINGS_VIEW=app_settings['JS_SETTINGS_VIEW'],
TRANSLATED_LANGUAGES=app_settings['TRANSLATED_LANGUAGES'],
MAP_BACKGROUND_FOGGED=app_settings['MAP_BACKGROUND_FOGGED'],
ACTION_HISTORY_ENABLED=app_settings['ACTION_HISTORY_ENABLED'],
registry=registry,
)
16 changes: 9 additions & 7 deletions mapentity/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,9 @@ def filter(self, qs, value):
return qs.filter(pk__in=filtered)


class MapEntityFilterSet(FilterSet):
bbox = PolygonFilter()

class Meta:
fields = ['bbox']

class BaseMapEntityFilterSet(FilterSet):
def __init__(self, *args, **kwargs):
super(MapEntityFilterSet, self).__init__(*args, **kwargs)
super(BaseMapEntityFilterSet, self).__init__(*args, **kwargs)
self.__bypass_labels()

def __bypass_labels(self):
Expand Down Expand Up @@ -123,3 +118,10 @@ def __set_placeholder(self, field, widget):
widget.attrs['data-placeholder'] = field.label
widget.attrs['title'] = field.label
widget.attrs['data-label'] = field.label


class MapEntityFilterSet(BaseMapEntityFilterSet):
bbox = PolygonFilter()

class Meta:
fields = ['bbox']
Binary file modified mapentity/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 681f21e

Please sign in to comment.