From d628ad546e47a82fe341740e4a3defe546e2f140 Mon Sep 17 00:00:00 2001 From: melinath Date: Wed, 16 Jun 2010 11:19:40 -0400 Subject: [PATCH] Added contentlet unicode and fixed container context bug. --- admin.py | 1 + models.py | 6 ++++++ templatetags/containers.py | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/admin.py b/admin.py index 1566c5b..5737041 100644 --- a/admin.py +++ b/admin.py @@ -41,6 +41,7 @@ class CollectionMemberInline(admin.TabularInline): extra = 1 classes = ('collapse-closed',) allow_add = True + fields = ('member_content_type', 'member_object_id', 'index',) class CollectionAdmin(admin.ModelAdmin): diff --git a/models.py b/models.py index 9210e1b..88863b2 100644 --- a/models.py +++ b/models.py @@ -389,6 +389,9 @@ class Contentlet(models.Model): name = models.CharField(max_length=255) content = models.TextField() dynamic = models.BooleanField(default=False) + + def __unicode__(self): + return self.name class ContentReference(models.Model): @@ -397,6 +400,9 @@ class ContentReference(models.Model): content_type = models.ForeignKey(ContentType, verbose_name='Content type') content_id = models.PositiveIntegerField(verbose_name='Content ID') content = generic.GenericForeignKey('content_type', 'content_id') + + def __unicode__(self): + return self.name register_templatetags('philo.templatetags.containers') diff --git a/templatetags/containers.py b/templatetags/containers.py index 2e40e53..90debf6 100644 --- a/templatetags/containers.py +++ b/templatetags/containers.py @@ -31,8 +31,7 @@ class ContainerNode(template.Node): if 'page' in context: container_content = self.get_container_content(context) - if self.nodelist_main is None: - self.nodelist_main + if not self.nodelist_main: if container_content and self.as_var: context[self.as_var] = container_content return '' -- 2.20.1