rockviewer/project_directory/three_d_viewer/models.py

25 lines
659 B
Python
Raw Normal View History

2013-07-24 15:41:59 +10:00
from django.db import models
class CommonInfo(models.Model):
name = models.CharField(max_length=100)
active = models.BooleanField(default=True)
def __unicode__(self):
return self.name
class Meta:
abstract = True
class Category(CommonInfo):
parent = models.ForeignKey('self', blank=True, null=True,
2013-07-24 21:45:19 +10:00
on_delete=models.SET_NULL,
related_name='children')
2013-07-24 15:41:59 +10:00
class Sample(CommonInfo):
2013-07-24 20:31:29 +10:00
model_filename = models.CharField(max_length=1000)
2013-07-24 15:41:59 +10:00
parent = models.ForeignKey(Category, blank=True, null=True,
on_delete=models.SET_NULL)