From: Lincoln de Sousa Date: Wed, 8 Oct 2008 18:38:48 +0000 (-0300) Subject: adding a new feature, now you need to say which content X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fema.git;a=commitdiff_plain;h=4db04c533992a1c15f5908d5d09fd69150145683 adding a new feature, now you need to say which content will be placed on the index (needs a database update) --- diff --git a/contents/models.py b/contents/models.py index e111b2f..78c760f 100644 --- a/contents/models.py +++ b/contents/models.py @@ -27,3 +27,12 @@ class Menu(models.Model): def __str__(self): return self.title + +class Index(models.Model): + entry = models.ForeignKey(Entry) + + class Admin: + pass + + def __str__(self): + return self.entry.title diff --git a/urls.py b/urls.py index b625832..03c46cd 100644 --- a/urls.py +++ b/urls.py @@ -19,7 +19,7 @@ from django.conf.urls.defaults import * from django.conf import settings from diario.settings import DIARIO_NUM_LATEST from diario.models import Entry -from contents.models import Menu +from contents.models import Menu, Index from ema.views import get_entry_by_slug MEDIA = {'document_root': settings.INSTANCE('media')} @@ -28,9 +28,11 @@ MEDIA = {'document_root': settings.INSTANCE('media')} # full version contains all entries and the other has just entries # without menus. -hasmenu = [x.entry.id for x in Menu.objects.all()] +hasmenuorindex = [x.entry.id for x in Menu.objects.all()] +hasmenuorindex.extend([x.entry.id for x in Index.objects.all()]) + info_dict = { - 'queryset': Entry.published_on_site.exclude(id__in=hasmenu), + 'queryset': Entry.published_on_site.exclude(id__in=hasmenuorindex), 'template_object_name': 'entry', 'extra_context': {'menus': Menu.objects.all()}, }