From: melinath Date: Wed, 16 Jun 2010 15:19:40 +0000 (-0400) Subject: Added contentlet unicode and fixed container context bug. X-Git-Tag: philo-0.9~78^2~2^2~3 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/d628ad546e47a82fe341740e4a3defe546e2f140?ds=inline;hp=c8256e579ea1a9e840619e1dade8f18353db7973 Added contentlet unicode and fixed container context bug. --- 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 ''