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_finds/models_finds.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_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index dadda2003..0e36cf29a 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -32,9 +32,9 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common.data_importer import post_importer_action, ImporterError from ishtar_common.utils import cached_label_changed, post_save_point -from ishtar_common.models import GeneralType, HierarchicalType, \ - BaseHistorizedItem, ShortMenuItem, LightHistorizedItem, \ - HistoricalRecords, OwnPerms, Source, Person, Basket, post_save_cache, \ +from ishtar_common.models import BaseSource, Document, GeneralType, \ + HierarchicalType, BaseHistorizedItem, ShortMenuItem, LightHistorizedItem, \ + HistoricalRecords, OwnPerms, Person, Basket, post_save_cache, \ ValueGetter, get_current_profile, IshtarImage, ThroughImage from archaeological_operations.models import AdministrativeAct, Operation @@ -828,6 +828,9 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, null=True) appraisal_date = models.DateField(_(u"Appraisal date"), blank=True, null=True) + documents = models.ManyToManyField( + Document, related_name='finds', verbose_name=_(u"Documents"), + blank=True) images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"), blank=True, through='FindImage') cached_label = models.TextField(_(u"Cached name"), null=True, blank=True, @@ -1443,13 +1446,13 @@ class FindImage(ThroughImage): related_name='associated_images') -class FindSource(Source): +class FindSource(BaseSource): SHOW_URL = 'show-findsource' MODIFY_URL = 'find_source_modify' TABLE_COLS = [ 'find__base_finds__context_record__operation', 'find__base_finds__context_record', 'find'] + \ - Source.TABLE_COLS + BaseSource.TABLE_COLS # search parameters BOOL_FIELDS = ['duplicate'] @@ -1475,7 +1478,7 @@ class FindSource(Source): 'find__datings__period': 'find__datings__period__pk', 'find__description': 'find__description__icontains', } - PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['find'] + PARENT_SEARCH_VECTORS = BaseSource.PARENT_SEARCH_VECTORS + ['find'] class Meta: verbose_name = _(u"Find documentation") |