diff options
Diffstat (limited to 'archaeological_finds/models.py')
-rw-r--r-- | archaeological_finds/models.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 4fd4543b4..947cd9067 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -67,6 +67,24 @@ class PreservationType(GeneralType): ordering = ('label',) +class ObjectType(GeneralType): + parent = models.ForeignKey("ObjectType", blank=True, null=True, + verbose_name=_(u"Parent")) + + class Meta: + verbose_name = _(u"Object type") + verbose_name_plural = _(u"Object types") + ordering = ('parent__label', 'label',) + + def __unicode__(self): + lbls = [self.label] + item = self + while item.parent: + item = item.parent + lbls.append(item.label) + return u" > ".join(reversed(lbls)) + + class BaseFind(BaseHistorizedItem, OwnPerms): label = models.CharField(_(u"ID"), max_length=60) external_id = models.CharField(_(u"External ID"), blank=True, null=True, @@ -225,6 +243,17 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): container = models.ForeignKey( Container, verbose_name=_(u"Container"), blank=True, null=True, related_name='finds') + is_complete = models.NullBooleanField(_(u"Is complete?"), blank=True, + null=True) + object_types = models.ManyToManyField( + ObjectType, verbose_name=_(u"Object types"), related_name='find') + length = models.FloatField(_(u"Length (cm)"), blank=True, null=True) + width = models.FloatField(_(u"Width (cm)"), blank=True, null=True) + height = models.FloatField(_(u"Height (cm)"), blank=True, null=True) + diameter = models.FloatField(_(u"Diameter (cm)"), blank=True, null=True) + mark = models.TextField(_(u"Mark"), blank=True, null=True) + comment = models.TextField(_(u"Comment"), blank=True, null=True) + previous_id = models.TextField(_(u"Previous ID"), blank=True, null=True) history = HistoricalRecords() def __init__(self, *args, **kwargs): |