diff bandmap/models.py @ 822:2c4f28b1c12a

Band map WIP: update admin dashboard for new band map entries.
author Brian Neal <bgneal@gmail.com>
date Wed, 24 Sep 2014 19:53:36 -0500
parents 9a0df7bd2409
children 09ed84a7394c
line wrap: on
line diff
--- a/bandmap/models.py	Tue Sep 23 20:40:31 2014 -0500
+++ b/bandmap/models.py	Wed Sep 24 19:53:36 2014 -0500
@@ -7,6 +7,11 @@
 from django.contrib.auth.models import User
 
 
+class BandEntryManager(models.Manager):
+    def new_entry_count(self):
+        return self.filter(is_approved=False).count()
+
+
 class BandEntry(models.Model):
     """Represents a band entry on the band map."""
     name = models.CharField(max_length=128)
@@ -21,6 +26,8 @@
     is_active = models.BooleanField(default=True, db_index=True)
     is_approved = models.BooleanField(default=False, db_index=True)
 
+    objects = BandEntryManager()
+
     class Meta:
         ordering = ['name']
         verbose_name_plural = 'band map entries'