1. Curtis Maloney
  2. gnocchi-faq

Commits

cur...@tinbrain.net  committed 33e3376

Fixed prepopulated_fields settings in Admin
Fixed typo in list_editable in Admin
Fixed verbose name for Categories
Added unique constraint for (category, slug) on Question

  • Participants
  • Parent commits c495750
  • Branches default

Comments (0)

Files changed (2)

File gnocchi_faq/admin.py

View file
  • Ignore whitespace
 class CategoryAdmin(admin.ModelAdmin):
     list_display = ('title', 'order',)
     list_editable = ('order',)
-    prepopulated_fields = ('slug',)
+    prepopulated_fields = {
+        'slug': ('title',)
+    }
     inlines = (
         QuestionInline,
     )
 
 class QuestionAdmin(admin.ModelAdmin):
     list_display = ('question', 'category', 'order', 'is_published',)
-    list_editable = ('order', 'is_publised',)
-    prepopulated_fields = ('slug',)
+    list_editable = ('order', 'is_published',)
+    prepopulated_fields = {
+        'slug': ('question',)
+    }
 admin.site.register(models.Question, QuestionAdmin)

File gnocchi_faq/models.py

View file
  • Ignore whitespace
 
     class Meta:
         ordering = ('order',)
+        verbose_name_plural = 'Categories'
     def __unicode__(self):
         return self.title
 
 
     class Meta:
         ordering = ('category__order', 'order',)
+        unique_together = (
+            ('category', 'slug',)
+        )
     def __unicode__(self):
         return self.question