Edited unicode methods and added some null=True, blank=True constraints.
[philo.git] / contrib / penfield / models.py
index 8d7e3ff..ec8ba69 100644 (file)
@@ -15,13 +15,16 @@ class Blog(Entity, Titled):
                return Tag.objects.filter(blogentries__blog=self)
 
 
+register_value_model(Blog)
+
+
 class BlogEntry(Entity, Titled):
        blog = models.ForeignKey(Blog, related_name='entries')
        author = models.ForeignKey(getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User'), related_name='blogentries')
        date = models.DateTimeField(default=datetime.now)
        content = models.TextField()
-       excerpt = models.TextField()
-       tags = models.ManyToManyField(Tag, related_name='blogentries')
+       excerpt = models.TextField(blank=True, null=True)
+       tags = models.ManyToManyField(Tag, related_name='blogentries', blank=True, null=True)
        
        class Meta:
                ordering = ['-date']
@@ -53,6 +56,9 @@ class BlogView(MultiView):
        entry_permalink_base = models.CharField(max_length=255, blank=False, default='entries')
        tag_permalink_base = models.CharField(max_length=255, blank=False, default='tags')
        
+       def __unicode__(self):
+               return u'BlogView for %s' % self.blog.title
+       
        @property
        def urlpatterns(self):
                base_patterns = patterns('',