diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 32 | 
1 files changed, 17 insertions, 15 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 44406fd89..de58e0da7 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -22,7 +22,6 @@ from itertools import groupby  from django.conf import settings  from django.contrib.gis.db import models -from django.core.cache import cache  from django.core.urlresolvers import reverse  from django.db import IntegrityError, transaction  from django.db.models import Q, Count, Sum, Max, Avg @@ -30,15 +29,15 @@ from django.db.models.signals import post_save, m2m_changed, post_delete  from django.forms import ValidationError  from django.utils.translation import ugettext_lazy as _, ugettext +from ishtar_common.models import BaseHistorizedItem, BaseSource, Dashboard, \ +    DashboardFormItem, Department, Document, DocumentTemplate, \ +    GeneralRecordRelations, GeneralRelationType, GeneralType, \ +    HistoricalRecords, IshtarImage, IshtarUser, LightHistorizedItem, \ +    OperationType, Organization, OwnPerms, Person, PersonType, \ +    post_delete_record_relation, post_save_cache, RelationItem, \ +    ShortMenuItem, SourceType, ThroughImage, Town, ValueGetter  from ishtar_common.utils import cached_label_changed, \ -    force_cached_label_changed, get_cache, mode - -from ishtar_common.models import GeneralType, BaseHistorizedItem, \ -    HistoricalRecords, LightHistorizedItem, OwnPerms, Department, Source,\ -    SourceType, Person, Organization, Town, Dashboard, IshtarUser, ValueGetter,\ -    DocumentTemplate, ShortMenuItem, DashboardFormItem, GeneralRelationType,\ -    GeneralRecordRelations, post_delete_record_relation, OperationType, \ -    post_save_cache, PersonType, IshtarImage, RelationItem, ThroughImage +    force_cached_label_changed, mode  class RemainType(GeneralType): @@ -129,6 +128,9 @@ class ArchaeologicalSite(BaseHistorizedItem):          _(u"Sinking date"), null=True, blank=True)      discovery_area = models.TextField(          _(u"Discovery area"), null=True, blank=True) +    documents = models.ManyToManyField( +        Document, related_name="sites", verbose_name=_(u"Documents"), +        blank=True)      images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"),                                      through='SiteImage', blank=True) @@ -459,6 +461,9 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,      comment = models.TextField(_(u"Comment"), null=True, blank=True)      scientific_documentation_comment = models.TextField(          _(u"Comment about scientific documentation"), null=True, blank=True) +    documents = models.ManyToManyField( +        Document, related_name='operations', verbose_name=_(u"Documents"), +        blank=True)      images = models.ManyToManyField(IshtarImage, verbose_name=_(u"Images"),                                      blank=True, through='OperationImage')      cached_label = models.CharField(_(u"Cached name"), max_length=500, @@ -1039,11 +1044,11 @@ class OperationByDepartment(models.Model):          db_table = 'operation_department' -class OperationSource(Source): +class OperationSource(BaseSource):      SHOW_URL = 'show-operationsource'      MODIFY_URL = 'operation_source_modify'      TABLE_COLS = ['operation__code_patriarche', 'operation__year', -                  'operation__operation_code', 'code'] + Source.TABLE_COLS +                  'operation__operation_code', 'code'] + BaseSource.TABLE_COLS      # search parameters      BOOL_FIELDS = ['duplicate'] @@ -1063,14 +1068,11 @@ class OperationSource(Source):          'operation__operation_code': _(u"Operation code"),          'code': _(u"Document code")      } -    PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['operation'] - +    PARENT_SEARCH_VECTORS = BaseSource.PARENT_SEARCH_VECTORS + ['operation']      # fields      operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"),                                    related_name="source") -    index = models.IntegerField(verbose_name=_(u"Index"), blank=True, -                                null=True)      class Meta:          verbose_name = _(u"Operation documentation") | 
