Edited unicode methods and added some null=True, blank=True constraints.
authorKriti Godey <kriti.godey@gmail.com>
Mon, 5 Jul 2010 17:57:03 +0000 (23:27 +0530)
committerKriti Godey <kriti.godey@gmail.com>
Mon, 5 Jul 2010 17:57:03 +0000 (23:27 +0530)
admin/base.py
contrib/penfield/models.py
models/nodes.py

index bdf9f38..457db17 100644 (file)
@@ -29,4 +29,7 @@ class EntityAdmin(admin.ModelAdmin):
        save_on_top = True
 
 
-admin.site.register(Tag)
\ No newline at end of file
+class TagAdmin(admin.ModelAdmin):
+       prepopulated_fields = {"slug": ("name",)}
+
+admin.site.register(Tag, TagAdmin)
\ No newline at end of file
index e0b7218..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']
index a8125ee..1e7622a 100644 (file)
@@ -108,4 +108,7 @@ class File(View):
                return response
        
        class Meta:
-               app_label = 'philo'
\ No newline at end of file
+               app_label = 'philo'
+       
+       def __unicode__(self):
+               return self.file.name
\ No newline at end of file