Initial changes to add an erb101 area of the site

This commit is contained in:
2014-11-17 16:35:55 +10:00
parent 5adaad5bf8
commit 7eccaa8bba
14 changed files with 201 additions and 7 deletions

View File

@@ -42,6 +42,10 @@ class Category(CommonInfo):
@property
def active_samples(self):
return self.samples.select_subclasses(Sample, Mineral).filter(active=True).order_by('name')
@property
def active_101_samples(self):
return self.samples.select_subclasses(Sample, Mineral).filter(active=True).filter(erb101_sample=True).order_by('name')
class Meta:
verbose_name_plural = "Categories"
@@ -59,6 +63,7 @@ class Sample(CommonInfo):
on_delete=models.SET_NULL,
related_name="samples")
viewed_count = models.IntegerField(default=0)
erb101_sample = models.BooleanField(default=False)
#Use the inheritance manager for handling subclasses
objects = InheritanceManager()