Added seperate minerals detail page
This commit is contained in:
parent
07c6260bde
commit
d5867c8d4a
6 changed files with 34 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ Defines the models that that Django application uses
|
|||
"""
|
||||
|
||||
from django.db import models
|
||||
from model_utils.managers import InheritanceManager
|
||||
|
||||
|
||||
class CommonInfo(models.Model):
|
||||
|
|
@ -32,6 +33,8 @@ class Category(CommonInfo):
|
|||
on_delete=models.SET_NULL,
|
||||
related_name='children')
|
||||
|
||||
objects = InheritanceManager()
|
||||
|
||||
@property
|
||||
def active_children(self):
|
||||
return self.children.filter(active=True).order_by('name')
|
||||
|
|
@ -53,6 +56,16 @@ class Sample(CommonInfo):
|
|||
on_delete=models.SET_NULL,
|
||||
related_name="samples")
|
||||
|
||||
#Use the inheritance manager for handling subclasses
|
||||
objects = InheritanceManager()
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
if isinstance(self, Mineral):
|
||||
return 'three_d_viewer:mineral_detail'
|
||||
else:
|
||||
return 'three_d_viewer:detail'
|
||||
|
||||
|
||||
class Mineral(Sample):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue