src/jocondelab/views/front_office.py
changeset 296 8c9ee4175638
parent 284 56db9b2c61e8
child 316 b5d6eff78369
--- a/src/jocondelab/views/front_office.py	Tue Jan 21 15:30:06 2014 +0100
+++ b/src/jocondelab/views/front_office.py	Tue Jan 21 16:42:32 2014 +0100
@@ -84,6 +84,7 @@
         npp = request.GET.get('count', 12 if emptysearch else 30)
         context["lang"] = lang
         context["current_page"] = page
+        context["last_page"] = False
         
         if self.template_name is None:
             if is_ajax and page > 1:
@@ -194,6 +195,9 @@
                 logger.debug(context["count"])
                 # Now that we have the list of ids
                 ns = Notice.objects.filter(pk__in=ids).extra(select={'relative_url': '"core_noticeimage"."relative_url"'}).filter(image=True).filter(images__main=True).order_by('id')
+                # We check if we are in the last page of the "real" notices and not the +/- number of notices.
+                if len(ns) < npp:
+                    context["last_page"] = True
         
         notices = []
         termsbythesaurus = get_terms_by_thesaurus(ns, lang)