diff options
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/ishtar_menu.py | 7 | ||||
-rw-r--r-- | archaeological_operations/models.py | 37 | ||||
-rw-r--r-- | archaeological_operations/wizards.py | 7 |
3 files changed, 30 insertions, 21 deletions
diff --git a/archaeological_operations/ishtar_menu.py b/archaeological_operations/ishtar_menu.py index 143d77f05..830a0ed09 100644 --- a/archaeological_operations/ishtar_menu.py +++ b/archaeological_operations/ishtar_menu.py @@ -100,12 +100,11 @@ MENU_SECTIONS = [ (102, SectionItem('dashboard', _(u"Dashboard"), childs=[ MenuItem('dashboard_main', _(u"General informations"), - model=models.File, - access_controls=['change_file', 'change_own_file']), + model=models.Operation, + access_controls=['change_operation']), MenuItem('dashboard_operation', _(u"Operations"), model=models.Operation, - access_controls=['change_operation', - 'change_own_operation']), + access_controls=['change_operation']), ]), ), ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 54e06b05c..855d7c8e4 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -35,8 +35,6 @@ from ishtar_common.models import GeneralType, BaseHistorizedItem, \ Person, Organization, Town, Dashboard, IshtarUser, ValueGetter, \ DocumentTemplate FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS -if FILES_AVAILABLE: - from archaeological_files.models import File class OperationType(GeneralType): preventive = models.BooleanField(_(u"Is preventive"), default=True) @@ -122,21 +120,23 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter): operation_code = models.IntegerField(_(u"Operation code"), null=True, blank=True) if FILES_AVAILABLE: - associated_file = models.ForeignKey(File, related_name='operations', - verbose_name=_(u"File"), blank=True, null=True) + associated_file = models.ForeignKey('archaeological_files.File', + related_name='operations', verbose_name=_(u"File"), + blank=True, null=True) operation_type = models.ForeignKey(OperationType, related_name='+', verbose_name=_(u"Operation type")) surface = models.IntegerField(_(u"Surface (m²)"), blank=True, null=True) remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains')) towns = models.ManyToManyField(Town, verbose_name=_(u"Towns")) - cost = models.IntegerField(_(u"Cost (€)"), blank=True, null=True) + cost = models.IntegerField(_(u"Cost (€)"), + blank=True, null=True) # preventive periods = models.ManyToManyField(Period, verbose_name=_(u"Periods")) scheduled_man_days = models.IntegerField(_(u"Scheduled man-days"), - blank=True, null=True) + blank=True, null=True) # preventive optional_man_days = models.IntegerField(_(u"Optional man-days"), - blank=True, null=True) + blank=True, null=True) # preventive effective_man_days = models.IntegerField(_(u"Effective man-days"), - blank=True, null=True) + blank=True, null=True) # preventive if settings.COUNTRY == 'fr': code_patriarche = models.IntegerField(u"Code PATRIARCHE", null=True, blank=True) @@ -144,15 +144,18 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter): code_dracar = models.CharField(u"Code DRACAR", max_length=10, null=True, blank=True) fnap_financing = models.FloatField(u"Financement FNAP (%)", - blank=True, null=True) + blank=True, null=True) # preventive fnap_cost = models.IntegerField(u"Financement FNAP (€)", - blank=True, null=True) + blank=True, null=True) # preventive zoning_prescription = models.NullBooleanField( - _(u"Prescription on zoning"), blank=True, null=True) + _(u"Prescription on zoning"), + blank=True, null=True) # preventive diag large_area_prescription = models.NullBooleanField( - _(u"Prescription on large area"), blank=True, null=True) + _(u"Prescription on large area"), + blank=True, null=True) # preventive diag geoarchaeological_context_prescription = models.NullBooleanField( - _(u"Prescription on geoarchaeological context"), blank=True, null=True) + _(u"Prescription on geoarchaeological context"), + blank=True, null=True) # preventive diag cira_rapporteur = models.ForeignKey(Person, related_name='+', null=True, blank=True, verbose_name=u"Rapporteur CIRA") negative_result = models.NullBooleanField( @@ -435,7 +438,8 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): operation = models.ForeignKey(Operation, blank=True, null=True, related_name='administrative_act', verbose_name=_(u"Operation")) if FILES_AVAILABLE: - associated_file = models.ForeignKey(File, blank=True, null=True, + associated_file = models.ForeignKey('archaeological_files.File', + blank=True, null=True, related_name='administrative_act', verbose_name=_(u"Archaelogical file")) signature_date = models.DateField(_(u"Signature date"), blank=True, @@ -546,8 +550,9 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): class Parcel(LightHistorizedItem): if FILES_AVAILABLE: - associated_file = models.ForeignKey(File, related_name='parcels', - blank=True, null=True, verbose_name=_(u"File")) + associated_file = models.ForeignKey('archaeological_files.File', + related_name='parcels', verbose_name=_(u"File"), + blank=True, null=True) operation = models.ForeignKey(Operation, related_name='parcels', blank=True, null=True, verbose_name=_(u"Operation")) year = models.IntegerField(_(u"Year"), blank=True, null=True) diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index a14924301..cacc44da1 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2012-2014 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -372,6 +372,11 @@ def is_preventive(form_name, model, type_key='operation_type', key=''): return False return func +def is_not_preventive(form_name, model, type_key='operation_type', key=''): + def func(self): + return not is_preventive(form_name, model, type_key, key)(self) + return func + def has_associated_file(form_name, file_key='associated_file', negate=False): def func(self): request = self.request |