diff options
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index da488f773..b12a31516 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -30,11 +30,11 @@ from django.utils.text import slugify from ishtar_common.utils import cached_label_changed -from ishtar_common.models import GeneralType, BaseHistorizedItem, \ - HistoricalRecords, OwnPerms, ShortMenuItem, Source, GeneralRelationType,\ - GeneralRecordRelations, post_delete_record_relation, get_image_path, \ - post_save_cache, ValueGetter, BulkUpdatedItem, IshtarImage, RelationItem, \ - Town, ThroughImage +from ishtar_common.models import BaseSource, Document, GeneralType, \ + BaseHistorizedItem, HistoricalRecords, OwnPerms, ShortMenuItem, \ + GeneralRelationType, GeneralRecordRelations, post_delete_record_relation,\ + get_image_path, post_save_cache, ValueGetter, BulkUpdatedItem, \ + IshtarImage, RelationItem, ThroughImage, Town from archaeological_operations.models import Operation, Period, Parcel, \ ArchaeologicalSite @@ -326,6 +326,9 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, point_2d = models.PointField(_(u"Point (2D)"), blank=True, null=True) point = models.PointField(_(u"Point (3D)"), blank=True, null=True, dim=3) polygon = models.PolygonField(_(u"Polygon"), blank=True, null=True) + documents = models.ManyToManyField( + Document, related_name='context_records', verbose_name=_(u"Documents"), + blank=True) images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"), blank=True, through='ContextRecordImage') cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, @@ -678,11 +681,11 @@ class RecordRelationView(models.Model): return u"{} \"{}\"".format(self.relation_type, self.right_record) -class ContextRecordSource(Source): +class ContextRecordSource(BaseSource): SHOW_URL = 'show-contextrecordsource' MODIFY_URL = 'record_source_modify' TABLE_COLS = ['context_record__operation__cached_label', 'context_record']\ - + Source.TABLE_COLS + + BaseSource.TABLE_COLS COL_LABELS = {'context_record__operation__cached_label': _(u"Operation")} # search parameters @@ -708,7 +711,8 @@ class ContextRecordSource(Source): 'context_record__datings__period__pk', 'context_record__unit': 'context_record__unit__pk', } - PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['context_record'] + PARENT_SEARCH_VECTORS = BaseSource.PARENT_SEARCH_VECTORS + [ + 'context_record'] class Meta: verbose_name = _(u"Context record documentation") |