comparison 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
comparison
equal deleted inserted replaced
821:71db8076dc3d 822:2c4f28b1c12a
3 """ 3 """
4 import datetime 4 import datetime
5 5
6 from django.db import models 6 from django.db import models
7 from django.contrib.auth.models import User 7 from django.contrib.auth.models import User
8
9
10 class BandEntryManager(models.Manager):
11 def new_entry_count(self):
12 return self.filter(is_approved=False).count()
8 13
9 14
10 class BandEntry(models.Model): 15 class BandEntry(models.Model):
11 """Represents a band entry on the band map.""" 16 """Represents a band entry on the band map."""
12 name = models.CharField(max_length=128) 17 name = models.CharField(max_length=128)
19 lon = models.FloatField() 24 lon = models.FloatField()
20 note = models.CharField(max_length=255, blank=True) 25 note = models.CharField(max_length=255, blank=True)
21 is_active = models.BooleanField(default=True, db_index=True) 26 is_active = models.BooleanField(default=True, db_index=True)
22 is_approved = models.BooleanField(default=False, db_index=True) 27 is_approved = models.BooleanField(default=False, db_index=True)
23 28
29 objects = BandEntryManager()
30
24 class Meta: 31 class Meta:
25 ordering = ['name'] 32 ordering = ['name']
26 verbose_name_plural = 'band map entries' 33 verbose_name_plural = 'band map entries'
27 34
28 def __unicode__(self): 35 def __unicode__(self):