1 from django.conf import settings
3 default_pagination = getattr(settings, 'DEFAULT_PAGINATION', 20)
5 class PaginationRegistrar(object):
8 def register(self, model, pagination=None):
9 self._registry[model] = pagination or default_pagination
11 def unregister(self, model):
13 del self._registry[model]
17 def get_for_model(self, model):
18 if model in self._registry:
19 return self._registry[model]
23 registry = getattr(settings, '_pagination_registry', None)
25 registry = PaginationRegistrar()
26 setattr(settings, '_pagination_registry', registry)