diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-30 20:26:21 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 09:57:24 +0200 |
commit | 66a376e081e335cf94ecf6fd41e5fe13a5445c57 (patch) | |
tree | 981ddce21bc6bad956c5b012baf9608fdfe909b1 /archaeological_context_records/models.py | |
parent | 3f3c588de0995c1aec212772059f921c165abfac (diff) | |
download | Ishtar-66a376e081e335cf94ecf6fd41e5fe13a5445c57.tar.bz2 Ishtar-66a376e081e335cf94ecf6fd41e5fe13a5445c57.zip |
Migrate images and sources to new document model (refs #4107)
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") |