Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action history #44

Merged
merged 11 commits into from
Apr 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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