diff options
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a1cd43b58..795c1a805 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -62,6 +62,18 @@ class Period(GeneralType): return self.label +class ReportState(GeneralType): + order = models.IntegerField(_(u"Order")) + + class Meta: + verbose_name = _(u"Report state") + verbose_name_plural = _(u"Report states") + ordering = ('order',) + + def __unicode__(self): + return self.label + + class ArchaeologicalSite(BaseHistorizedItem): reference = models.CharField(_(u"Reference"), max_length=20, unique=True) name = models.CharField(_(u"Name"), max_length=200, @@ -122,6 +134,7 @@ QUALITY = (('ND', _(u"Not documented")), class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, DashboardFormItem): QUALITY_DICT = dict(QUALITY) + SHOW_URL = 'show-operation' TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns', 'start_date', 'excavation_end_date'] if FILES_AVAILABLE: @@ -172,6 +185,9 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, # preventive effective_man_days = models.IntegerField(_(u"Effective man-days"), blank=True, null=True) + report_processing = models.ForeignKey( + ReportState, verbose_name=_(u"Report processing"), + blank=True, null=True) if settings.COUNTRY == 'fr': code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True, blank=True, unique=True) @@ -257,7 +273,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, @property def short_label(self): if settings.COUNTRY == 'fr': - return self.code_patriarche + return self.reference return unicode(self) @property @@ -457,6 +473,7 @@ class RelationType(GeneralRelationType): class RecordRelations(GeneralRecordRelations, models.Model): + MAIN_ATTR = 'left_record' left_record = models.ForeignKey(Operation, related_name='right_relations') right_record = models.ForeignKey(Operation, @@ -466,6 +483,7 @@ class RecordRelations(GeneralRecordRelations, models.Model): class Meta: verbose_name = _(u"Operation record relation") verbose_name_plural = _(u"Operation record relations") + ordering = ('left_record', 'relation_type') post_delete.connect(post_delete_record_relation, sender=RecordRelations) @@ -505,6 +523,7 @@ class OperationSource(Source): null=True) TABLE_COLS = ['operation.year', 'operation.operation_code'] + \ Source.TABLE_COLS + SHOW_URL = 'show-operationsource' @property def owner(self): |