diff --git a/requirements.pip b/requirements.pip index e62c4ce8..df5af99b 100644 --- a/requirements.pip +++ b/requirements.pip @@ -7,4 +7,5 @@ django==1.4.2 #south==0.7.6 git+git://github.com/petry/django-foundation.git -git+git://github.com/yohanboniface/django-chickpea.git \ No newline at end of file +git+git://github.com/yohanboniface/django-chickpea.git +git+git://github.com/frankban/django-endless-pagination.git \ No newline at end of file diff --git a/youmap/settings/base.py b/youmap/settings/base.py index 7ba09204..20557849 100644 --- a/youmap/settings/base.py +++ b/youmap/settings/base.py @@ -28,6 +28,7 @@ INSTALLED_APPS = ( # 'youmap.apps.', 'chickpea', 'foundation', + 'endless_pagination', #'south', @@ -102,6 +103,7 @@ TEMPLATE_DIRS = ( ) TEMPLATE_CONTEXT_PROCESSORS += ( + 'django.core.context_processors.request', ) #============================================================================== diff --git a/youmap/templates/base.html b/youmap/templates/base.html index ce667adb..a0031ec4 100644 --- a/youmap/templates/base.html +++ b/youmap/templates/base.html @@ -37,6 +37,7 @@ + {% block bottom_js %} +{% endblock bottom_js %} \ No newline at end of file diff --git a/youmap/views.py b/youmap/views.py index 3c487735..d4ca27f4 100644 --- a/youmap/views.py +++ b/youmap/views.py @@ -5,6 +5,7 @@ from chickpea.models import Map class Home(TemplateView): template_name = "youmap/home.html" + list_template_name = "chickpea/map_list.html" def get_context_data(self, **kwargs): maps = Map.objects.all()[:20] @@ -12,4 +13,13 @@ class Home(TemplateView): "maps": maps } + def get_template_names(self): + """ + Dispatch template according to the kind of request: ajax or normal. + """ + if self.request.is_ajax(): + return [self.list_template_name] + else: + return [self.template_name] + home = Home.as_view()