diff options
Diffstat (limited to 'archaeological_files/models.py')
| -rw-r--r-- | archaeological_files/models.py | 27 | 
1 files changed, 18 insertions, 9 deletions
| diff --git a/archaeological_files/models.py b/archaeological_files/models.py index a9c14cb3a..1d60b9c17 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -24,8 +24,7 @@ from django.contrib.gis.db import models  from django.core.cache import cache  from django.db.models import Q, Count, Sum  from django.db.models.signals import post_save, m2m_changed, post_delete -from django.utils.translation import ugettext_lazy as _, pgettext_lazy, \ -    activate, deactivate +from django.utils.translation import ugettext_lazy as _, pgettext_lazy  from ishtar_common.utils import cached_label_changed, get_cache, \      get_current_year, m2m_historization_changed @@ -257,12 +256,17 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,          verbose_name=_(u"Planning service organization"),          on_delete=models.SET_NULL,)  # service instructeur      permit_type = models.ForeignKey( -        PermitType, verbose_name=_(u"Permit type"), blank=True, null=True) +        PermitType, verbose_name=_(u"Permit type"), blank=True, null=True, +        on_delete=models.SET_NULL +    )      permit_reference = models.TextField(_(u"Permit reference"), blank=True,                                          null=True)      end_date = models.DateField(_(u"Closing date"), null=True, blank=True) -    main_town = models.ForeignKey(Town, verbose_name=_(u"Main town"), null=True, -                                  blank=True, related_name='file_main') +    main_town = models.ForeignKey( +        Town, verbose_name=_(u"Main town"), null=True, blank=True, +        related_name='file_main', +        on_delete=models.SET_NULL +    )      towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"),                                     related_name='file', blank=True)      creation_date = models.DateField( @@ -270,11 +274,14 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,          null=True)      reception_date = models.DateField(_(u'Reception date'), blank=True,                                        null=True) -    related_file = models.ForeignKey("File", verbose_name=_(u"Related file"), -                                     blank=True, null=True) +    related_file = models.ForeignKey( +        "File", verbose_name=_(u"Related file"), blank=True, null=True, +        on_delete=models.SET_NULL +    )      if settings.COUNTRY == 'fr':          saisine_type = models.ForeignKey(              SaisineType, blank=True, null=True, +            on_delete=models.SET_NULL,              verbose_name=u"Type de saisine")          instruction_deadline = models.DateField(_(u'Instruction deadline'),                                                  blank=True, null=True) @@ -292,8 +299,9 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,      departments = models.ManyToManyField(          Department, verbose_name=_(u"Departments"), blank=True)      requested_operation_type = models.ForeignKey( -        OperationType, related_name='+', null=True, -        blank=True, verbose_name=_(u"Requested operation type")) +        OperationType, related_name='+', +        on_delete=models.SET_NULL, +        null=True, blank=True, verbose_name=_(u"Requested operation type"))      organization = models.ForeignKey(          Organization, blank=True, null=True, verbose_name=_(u"Organization"),          related_name='files', on_delete=models.SET_NULL) @@ -721,6 +729,7 @@ class FileByDepartment(models.Model):      """      file = models.ForeignKey(File, verbose_name=_(u"File"))      department = models.ForeignKey(Department, verbose_name=_(u"Department"), +                                   on_delete=models.DO_NOTHING,                                     blank=True, null=True)      class Meta: | 
