--- a/src/hashcut/views.py Thu Dec 06 12:38:51 2012 +0100
+++ b/src/hashcut/views.py Thu Dec 06 14:30:23 2012 +0100
@@ -40,7 +40,7 @@
m1 = None
m2 = None
last_mashups = None
- mashups = Mashup.objects.filter(branding=brd).order_by('-project__creation_date')[:10]
+ mashups = Mashup.objects.filter(branding=brd).order_by('-project__creation_date')[:6]
logging.debug(repr(mashups))
l = len(mashups)
if l>0:
@@ -49,8 +49,11 @@
m2 = mashups[1]
if l>2:
last_mashups = mashups[2:]
+
+ contents = Content.objects.filter(tags__icontains=branding).order_by('?')[:4]
+
context = self.get_context_dict(request)
- context.update({"mashups":last_mashups, "m1":m1, "m2":m2})
+ context.update({"mashups":last_mashups, "contents": contents, "m1":m1, "m2":m2})
return self.render_to_response(context)
@@ -179,6 +182,32 @@
context = self.get_context_dict(request)
context.update({"results":results})
return self.render_to_response(context)
+
+
+
+class MashupAllContents(TemplateResponseMixin, MashupContextView):
+
+ def get_template_names(self):
+ return "mashup_all_contents.html"
+
+ def get(self, request, branding="iri", **kwargs):
+ page = request.GET.get("page") or 1
+ self.branding = branding
+
+ contents = Content.objects.filter(tags__icontains=branding)
+ nb = getattr(settings, 'LDT_FRONT_MEDIA_PER_PAGE', 9)
+ if page=="x":
+ nb = contents.count()
+
+ paginator = Paginator(contents, nb)
+ try:
+ results = paginator.page(page)
+ except (EmptyPage, InvalidPage):
+ results = paginator.page(paginator.num_pages)
+
+ context = self.get_context_dict(request)
+ context.update({"results":results})
+ return self.render_to_response(context)