Browse files

Filter for admin, show product names

  • Loading branch information...
1 parent 094d005 commit 04e27205cf2a60dc444b42f1b7e14083503b6659 @nigelbabu nigelbabu committed Oct 25, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −0 apps/feedback/admin.py
  2. +3 −2 apps/feedback/models.py
View
1 apps/feedback/admin.py
@@ -44,6 +44,7 @@ class TermAdmin(admin.ModelAdmin):
class VersionCountAdmin(admin.ModelAdmin):
list_display = ('product', 'version', 'num_opinions', 'active')
+ list_filter = ('active', 'product')
ordering = ('-version', 'product')
readonly_fields = ('product', 'version', 'num_opinions', 'version_int')
search_fields = ['version']
View
5 apps/feedback/models.py
@@ -217,11 +217,12 @@ class Meta:
class VersionCount(ModelBase):
"""Denormalized model built from product info and opinion counts.
-
+
Built from products, versions, number of opinions, and active status.
"""
- product = models.PositiveSmallIntegerField(db_index=True)
+ product = models.PositiveSmallIntegerField(db_index=True,
+ choices=((prod, PRODUCT_IDS[prod].pretty) for prod in PRODUCT_IDS))
version = models.CharField(max_length=30, db_index=True)
version_int = models.BigIntegerField(db_index=True)
num_opinions = models.IntegerField()

0 comments on commit 04e2720

Please sign in to comment.