diff options
Diffstat (limited to 'archaeological_files')
-rw-r--r-- | archaeological_files/data_importer.py | 98 | ||||
-rw-r--r-- | archaeological_files/ishtar_menu.py | 6 | ||||
-rw-r--r-- | archaeological_files/locale/fr/LC_MESSAGES/django.po | 237 | ||||
-rw-r--r-- | archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py | 442 | ||||
-rw-r--r-- | archaeological_files/models.py | 58 | ||||
-rw-r--r-- | archaeological_files/templates/ishtar/sheet_file.html | 13 | ||||
-rw-r--r-- | archaeological_files/urls.py | 3 | ||||
-rw-r--r-- | archaeological_files/views.py | 30 | ||||
-rw-r--r-- | archaeological_files/wizards.py | 10 |
9 files changed, 734 insertions, 163 deletions
diff --git a/archaeological_files/data_importer.py b/archaeological_files/data_importer.py index ae0cf340c..2b715cb42 100644 --- a/archaeological_files/data_importer.py +++ b/archaeological_files/data_importer.py @@ -41,7 +41,36 @@ class ImportClosingFormater(ImportFormater): obj.end_date = open_date + datetime.timedelta(30) obj.save() -class FileImporterSraPdL(Importer): +class ImportMayorFormater(ImportFormater): + def post_process(self, obj, context, value, owner=None): + value = self.formater.format(value) + if type(self.field_name) in (list, tuple): + return #not managed + associated_obj = get_object_from_path(obj, self.field_name) + if not value or not obj.main_town or not associated_obj: + return + if slugify(value).endswith('le-maire'): + value += u" de " + obj.main_town.name + value = value[:300] + setattr(associated_obj, self.field_name.split('__')[-1], value) + associated_obj.save() + +class FilePostProcessing(object): + # erroneaous date to be easily identified on post-processing + DEFAULT_YEAR = 1756 + EXTRA_DEFAULTS = {tuple():{'year':DEFAULT_YEAR}} + + def post_processing(self, item, data): + if item.year == self.DEFAULT_YEAR: + if item.creation_date: + item.year = item.creation_date.year + elif item.reception_date: + item.year = item.reception_date.year + item.save() + return item + +class FileImporterSraPdL(FilePostProcessing, Importer): + DESC = u"Exports dossiers SRA PdL : importeur Filemaker dossiers" LINE_FORMAT = [] OBJECT_CLS = models.File DEFAULTS = {('responsible_town_planning_service', 'attached_to'):{ @@ -52,42 +81,43 @@ class FileImporterSraPdL(Importer): txt_idx="general_contractor")}, tuple():{ 'file_type': models.FileType.objects.get( - txt_idx='undefined'), + txt_idx='preventive'), }, ('in_charge',):{'attached_to':None}, # initialized in __init__ } + STR_CUT = {tuple():{'comment':2000}} def _init_line_format(self): tf = TownFormater() tf.town_dct_init() self.line_format = [ None, # A, 1 - ImportFormater(['address', 'postal_code', ['towns', 'parcels__town']], # B, 2 + ImportFormater(['address', 'postal_code', ['main_town', 'parcels__town']], # B, 2 [UnicodeFormater(500, clean=True), UnicodeFormater(5, re_filter=RE_CD_POSTAL_FILTER), tf], regexp=RE_ADD_CD_POSTAL_TOWN, regexp_formater_args=[[0], [1], [2, 1]], required=False, - comment="Dossier - adresse"), - ImportFormater('general_contractor__raw_name', # C, 3 TODO - extraire nom_prenom_titre + comment=u"Dossier - adresse"), + ImportMayorFormater('general_contractor__raw_name', # C, 3 TODO - extraire nom_prenom_titre UnicodeFormater(200), comment=u"Aménageur - nom brut", - duplicate_fields=['general_contractor__attached_to__name'], + post_processing=True, required=False), - ImportFormater(['general_contractor__attached_to__address', # D, 4 - 'general_contractor__attached_to__postal_code', - 'general_contractor__attached_to__town'], + ImportFormater(['general_contractor__address', # D, 4 + 'general_contractor__postal_code', + 'general_contractor__town'], [UnicodeFormater(500, clean=True), UnicodeFormater(5, re_filter=RE_CD_POSTAL_FILTER), TownFormater(town_full_dct=tf._town_full_dct, town_dct=tf._town_dct)], regexp=RE_ADD_CD_POSTAL_TOWN, regexp_formater_args=[[0], [1], [2, 1]], required=False, - comment="Aménageur - adresse"), + comment=u"Aménageur - adresse"), ImportFormater("general_contractor__title", # E, 5 StrChoiceFormater(Person.TYPE, cli=True), required=False, - comment="Aménageur - titre"), + comment=u"Aménageur - titre"), None, # F, 6 None, # G, 7 None, # H, 8 @@ -96,19 +126,18 @@ class FileImporterSraPdL(Importer): required=False), ImportParcelFormater('', required=False, post_processing=True), # J, 10 None, # K, 11 - ImportFormater([['towns', 'parcels__town']], # L, 12 + ImportFormater([['main_town', 'parcels__town']], # L, 12 tf, required=False, - comment="Commune (si non définie avant)"), - ImportFormater([['towns', 'parcels__town']], # M, 13 + comment=u"Commune (si non définie avant)"), + ImportFormater([['main_town', 'parcels__town']], # M, 13 tf, required=False, - comment="Commune (si non définie avant)"), + comment=u"Commune (si non définie avant)"), ImportFormater('saisine_type', # N, 14 - StrChoiceFormater(models.SaisineType.get_types(), - model=models.SaisineType, cli=True), + TypeFormater(models.SaisineType), required=False, - comment="Type de saisine"), + comment=u"Type de saisine"), None, # O, 15 ImportFormater('comment', # P, 16 UnicodeFormater(2000), @@ -117,9 +146,9 @@ class FileImporterSraPdL(Importer): None, # Q, 17 ImportFormater([ 'responsible_town_planning_service__raw_name', # R, 18 service instructeur - 'responsible_town_planning_service__attached_to__address', - 'responsible_town_planning_service__attached_to__postal_code', - 'responsible_town_planning_service__attached_to__town',], + 'responsible_town_planning_service__address', + 'responsible_town_planning_service__postal_code', + 'responsible_town_planning_service__town',], [UnicodeFormater(300, clean=True), UnicodeFormater(300, clean=True), UnicodeFormater(5, re_filter=RE_CD_POSTAL_FILTER), @@ -127,14 +156,14 @@ class FileImporterSraPdL(Importer): town_dct=tf._town_dct)], regexp=RE_NAME_ADD_CD_POSTAL_TOWN, regexp_formater_args=[[0], [1], [2], [3, 2]], - comment="Aménageur - adresse", + comment=u"Aménageur - adresse", required=False), ImportFormater('comment', # S, 19 UnicodeFormater(2000), comment=u"Commentaire", concat=True, required=False), ImportYearFormater('reception_date', # T, 20 - DateFormater(), + DateFormater(['%d/%m/%Y', '%d/%m/%Y']), comment=u"Date de création", required=False, duplicate_fields=['creation_date']), @@ -153,7 +182,7 @@ class FileImporterSraPdL(Importer): None, # AG, 33 None, # AH, 34 ImportFormater('creation_date', # AI, 35 - DateFormater(), + DateFormater(['%d/%m/%Y', '%d/%m/%y']), force_value=True, comment=u"Date de création", required=False,), @@ -182,7 +211,7 @@ class FileImporterSraPdL(Importer): ImportFormater('permit_reference', # AW, 49 UnicodeFormater(300, clean=True), regexp=RE_PERMIT_REFERENCE, - comment="Réf. du permis de construire", + comment=u"Réf. du permis de construire", required=False), None, # AX, 50 None, # AY, 51 @@ -191,10 +220,10 @@ class FileImporterSraPdL(Importer): None, # BB, 54 None, # BC, 55 None, # BD, 56 - ImportFormater([['towns', 'parcels__town']], # BE, 57 + ImportFormater([['main_town', 'parcels__town']], # BE, 57 TownINSEEFormater(), required=False, - comment="Commune (si non définie avant)"), + comment=u"Commune (si non définie avant)"), ImportFormater('comment', # BF, 58 UnicodeFormater(2000), comment=u"Commentaire", @@ -212,15 +241,11 @@ class FileImporterSraPdL(Importer): None, # BQ, 69 None, # BR, 70 None, # BS, 71 - ImportFormater( - 'responsible_town_planning_service__attached_to__name', # BT, 72 service instructeur - UnicodeFormater(300, clean=True), - regexp=RE_ORGA, - comment="Service instructeur - nom", - required=False), + None, # BT, 72 None, # BU, 73 ImportClosingFormater('', StrToBoolean(cli=True), - post_processing=True, required=False), # BV, 74, end date + post_processing=True, required=False, + comment=u'Dossier clos'), # BV, 74, end date ImportClosingFormater('in_charge__raw_name', # BW, 75 responsable UnicodeFormater(200), comment=u"Responsable - nom brut", @@ -241,10 +266,9 @@ class FileImporterSraPdL(Importer): None, # CE, 83 None, # CF, 84 ImportFormater('permit_type', - StrChoiceFormater(models.PermitType.get_types(), - model=models.PermitType, cli=True), + TypeFormater(models.PermitType), required=False, - comment="Type de permis"), # CG, 85 + comment=u"Type de permis"), # CG, 85 None, # CH, 85 ] diff --git a/archaeological_files/ishtar_menu.py b/archaeological_files/ishtar_menu.py index fc0401115..df4946330 100644 --- a/archaeological_files/ishtar_menu.py +++ b/archaeological_files/ishtar_menu.py @@ -46,9 +46,13 @@ MENU_SECTIONS = [ access_controls=['delete_file', 'delete_own_file']), SectionItem('admin_act_files', _(u"Administrative act"), childs=[ + MenuItem('file_administrativeactfile_search', + _(u"Search"), + model=AdministrativeAct, + access_controls=['change_file', 'change_own_file']), MenuItem('file_administrativeactfile', _(u"Add"), - model=Operation, + model=AdministrativeAct, access_controls=['change_file', 'change_own_file']), MenuItem('file_administrativeactfile_modification', _(u"Modification"), diff --git a/archaeological_files/locale/fr/LC_MESSAGES/django.po b/archaeological_files/locale/fr/LC_MESSAGES/django.po index c358ca579..c9c502d6e 100644 --- a/archaeological_files/locale/fr/LC_MESSAGES/django.po +++ b/archaeological_files/locale/fr/LC_MESSAGES/django.po @@ -1,15 +1,15 @@ # Ishtar po translation. -# Copyright (C) 2010-2015 +# Copyright (C) 2010-2014 # This file is distributed under the same license as the Ishtar package. -# Étienne Loks <etienne.loks at peacefrogs net>, 2010-2015. +# Étienne Loks <etienne.loks at peacefrogs net>, 2010-2014. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: alpha\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-24 23:33+0100\n" -"PO-Revision-Date: 2015-01-24\n" +"POT-Creation-Date: 2014-12-31 12:06+0100\n" +"PO-Revision-Date: 2010-12-09\n" "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n" "Language-Team: \n" "Language: \n" @@ -24,8 +24,8 @@ msgid "Choice for \"%s\" is not available. Which one is relevant?\n" msgstr "Le choix pour \"%s\" n'est pas disponible. Lequel est pertinent ?\n" #: forms.py:55 forms.py:188 forms.py:228 forms.py:339 forms.py:379 -#: models.py:70 templates/ishtar/sheet_file.html:98 -#: templates/ishtar/sheet_file.html:126 +#: models.py:70 templates/ishtar/sheet_file.html:105 +#: templates/ishtar/sheet_file.html:133 msgid "Year" msgstr "Année" @@ -65,7 +65,7 @@ msgstr "Aménageur" msgid "Organization of general contractor" msgstr "Organisation de l'aménageur" -#: forms.py:80 forms.py:383 templates/ishtar/sheet_file.html:102 +#: forms.py:80 forms.py:383 templates/ishtar/sheet_file.html:109 msgid "In charge" msgstr "Responsable" @@ -85,11 +85,11 @@ msgstr "Recherche de dossiers archéologiques" msgid "You should select a file." msgstr "Vous devez sélectionner un dossier archéologique." -#: forms.py:125 forms.py:197 models.py:98 +#: forms.py:125 forms.py:197 models.py:100 msgid "Creation date" msgstr "Date de création" -#: forms.py:126 forms.py:269 models.py:100 +#: forms.py:126 forms.py:269 models.py:102 msgid "Reception date" msgstr "Date de réception" @@ -113,7 +113,7 @@ msgstr "Date après" msgid "Date before" msgstr "Date avant" -#: forms.py:178 templates/ishtar/sheet_file.html:24 +#: forms.py:178 templates/ishtar/sheet_file.html:31 msgid "General" msgstr "Général" @@ -125,23 +125,23 @@ msgstr "Responsable" msgid "Name" msgstr "Nom" -#: forms.py:200 models.py:102 +#: forms.py:200 models.py:104 msgid "Related file" msgstr "Dossier en relation avec" -#: forms.py:204 forms.py:310 models.py:118 templates/ishtar/sheet_file.html:85 +#: forms.py:204 forms.py:310 models.py:122 templates/ishtar/sheet_file.html:92 msgid "Comment" msgstr "Commentaire" -#: forms.py:208 models.py:109 +#: forms.py:208 models.py:113 msgid "Total surface (m²)" msgstr "Surface totale des terrains (m²)" -#: forms.py:211 models.py:113 +#: forms.py:211 models.py:119 msgid "Main address" msgstr "Adresse des terrains" -#: forms.py:212 models.py:114 +#: forms.py:212 msgid "Main address - complement" msgstr "Adresse des terrains - complément" @@ -162,24 +162,24 @@ msgstr "Responsable au service instructeur" msgid "Permit type" msgstr "Type de permis" -#: forms.py:263 models.py:112 +#: forms.py:263 models.py:116 msgid "Total developed surface (m²)" msgstr "Surface totale aménagée (m²)" -#: forms.py:280 templates/ishtar/sheet_file.html:75 +#: forms.py:280 templates/ishtar/sheet_file.html:82 #: templates/ishtar/dashboards/dashboard_file.html:42 msgid "Research archaeology" msgstr "Archéologie programmée" -#: forms.py:288 models.py:121 templates/ishtar/sheet_file.html:76 +#: forms.py:288 models.py:125 templates/ishtar/sheet_file.html:83 msgid "Departments" msgstr "Départements" -#: forms.py:298 models.py:133 +#: forms.py:298 models.py:137 msgid "Scientist in charge" msgstr "Responsable scientifique" -#: forms.py:300 models.py:126 templates/ishtar/sheet_file.html:78 +#: forms.py:300 models.py:130 templates/ishtar/sheet_file.html:85 msgid "Requested operation type" msgstr "Type d'opération demandée" @@ -187,21 +187,21 @@ msgstr "Type d'opération demandée" msgid "Lead organization" msgstr "Organisation porteuse du projet" -#: forms.py:319 models.py:137 templates/ishtar/sheet_file.html:83 +#: forms.py:319 models.py:141 templates/ishtar/sheet_file.html:90 msgid "Classified area" msgstr "Au sein d'un site classé" -#: forms.py:321 models.py:139 templates/ishtar/sheet_file.html:84 +#: forms.py:321 models.py:143 templates/ishtar/sheet_file.html:91 msgid "Protected area" msgstr "Au sein d'un secteur sauvegardé" #: forms.py:332 msgid "Would you like to close this archaeological file?" -msgstr "Voulez-vous clore ce dossier archéologique ?" +msgstr "Voulez vous clore ce dossier archéologique ?" #: forms.py:336 msgid "Would you like to delete this archaelogical file ?" -msgstr "Voulez-vous supprimer ce dossier archéologique ?" +msgstr "Voulez vous supprimer ce dossier archéologique ?" #: forms.py:340 msgid "Index" @@ -219,7 +219,7 @@ msgstr "Date de signature après" msgid "Signature date before" msgstr "Date de signature avant" -#: ishtar_menu.py:30 models.py:154 templates/ishtar/sheet_file.html:6 +#: ishtar_menu.py:30 models.py:158 templates/ishtar/sheet_file.html:6 msgid "Archaeological file" msgstr "Dossier" @@ -237,7 +237,7 @@ msgstr "Modification" #: ishtar_menu.py:41 msgid "Closing" -msgstr "Clôture" +msgstr "Clotûre" #: ishtar_menu.py:44 ishtar_menu.py:58 msgid "Deletion" @@ -263,7 +263,7 @@ msgstr "Tableau de bord" msgid "General informations" msgstr "Informations générales" -#: ishtar_menu.py:73 models.py:155 +#: ishtar_menu.py:73 models.py:159 #: templates/ishtar/dashboards/dashboard_file.html:8 msgid "Archaeological files" msgstr "Dossiers archéologiques" @@ -282,7 +282,7 @@ msgstr "Types de permis" #: models.py:60 msgid "Delay (in days)" -msgstr "Délai (en jours)" +msgstr "Delai (en jours)" #: models.py:74 msgid "Internal reference" @@ -290,113 +290,125 @@ msgstr "Référence interne" #: models.py:95 msgid "Closing date" -msgstr "Date de clôture" +msgstr "Date de clotûre" #: models.py:96 +msgid "Town" +msgstr "Commune" + +#: models.py:98 msgid "Towns" msgstr "Communes" -#: models.py:107 +#: models.py:109 msgid "Ref. number" msgstr "Réf. numérique" -#: models.py:116 +#: models.py:111 +msgid "Instruction deadline" +msgstr "Date limite d'instruction" + +#: models.py:117 +msgid "Locality" +msgstr "Lieu-dit" + +#: models.py:120 msgid "Main address - postal code" msgstr "Adresse des terrains - code postal" -#: models.py:128 templates/ishtar/sheet_file.html:79 +#: models.py:132 templates/ishtar/sheet_file.html:86 msgid "Organization" msgstr "Organisation" -#: models.py:134 +#: models.py:138 msgid "Research archaeology comment" msgstr "Commentaire archéologie programmée" -#: models.py:148 +#: models.py:152 msgid "Cached name" msgstr "Nom en cache" -#: models.py:150 +#: models.py:154 msgid "Imported line" msgstr "Ligne importée" -#: models.py:157 +#: models.py:161 msgid "Can view all Archaelogical file" -msgstr "Peut voir tous les dossiers archéologiques" +msgstr "Peut voir tous les dossier archéologique" -#: models.py:158 +#: models.py:162 msgid "Can view own Archaelogical file" msgstr "Peut voir son propre Dossier" -#: models.py:159 +#: models.py:163 msgid "Can add own Archaelogical file" msgstr "Peut ajouter son propre Dossier" -#: models.py:160 +#: models.py:164 msgid "Can change own Archaelogical file" msgstr "Peut changer son propre Dossier" -#: models.py:161 +#: models.py:165 msgid "Can delete own Archaelogical file" msgstr "Peut supprimer son propre Dossier" -#: models.py:162 +#: models.py:166 msgid "Can close File" msgstr "Peut fermer un dossier" -#: models.py:168 +#: models.py:172 msgid "FILE" msgstr "DOSSIER" -#: models.py:270 +#: models.py:274 msgid "Intercommunal" msgstr "Intercommunal" -#: models.py:334 +#: models.py:340 msgid "File" msgstr "Dossier" -#: models.py:335 +#: models.py:341 msgid "Department" msgstr "Département" -#: views.py:121 +#: views.py:130 msgid "File search" msgstr "Recherche de dossier archéologique" -#: views.py:131 +#: views.py:140 msgid "New file" msgstr "Nouveau dossier archéologique" -#: views.py:150 +#: views.py:159 msgid "File modification" msgstr "Modification de dossier archéologique" -#: views.py:172 +#: views.py:181 msgid "File closing" -msgstr "Clôture de dossier" +msgstr "Clotûre de dossier" -#: views.py:179 +#: views.py:188 msgid "File deletion" msgstr "Suppression de dossier archéologique" -#: views.py:187 +#: views.py:196 msgid "File: new administrative act" msgstr "Dossier : nouvel acte administratif" -#: views.py:197 +#: views.py:206 msgid "File: administrative act modification" msgstr "Dossier : modification d'acte administratif" -#: views.py:206 +#: views.py:215 msgid "File: administrative act deletion" msgstr "Dossier : suppression acte administratif" -#: wizards.py:139 templates/ishtar/sheet_file.html:96 +#: wizards.py:145 templates/ishtar/sheet_file.html:103 msgid "Associated operations" msgstr "Opérations associées" -#: wizards.py:165 wizards.py:175 +#: wizards.py:171 wizards.py:181 msgid "Archaelogical file" msgstr "Dossier" @@ -418,7 +430,7 @@ msgstr "Version précédente" #: templates/ishtar/sheet_file.html:17 msgid "Are you sure to rollback to this version?" -msgstr "Êtes-vous sûr de vouloir revenir à cette version ?" +msgstr "Êtes vous sûr de vouloir revenir à cette version ?" #: templates/ishtar/sheet_file.html:18 msgid "Next version" @@ -436,186 +448,190 @@ msgstr "Fichier OpenOffice.org" msgid "PDF file" msgstr "Fichier PDF" -#: templates/ishtar/sheet_file.html:23 +#: templates/ishtar/sheet_file.html:24 msgid "Modify" msgstr "Modifier" -#: templates/ishtar/sheet_file.html:25 +#: templates/ishtar/sheet_file.html:27 +msgid "Add an associated archaeological operation" +msgstr "Ajouter une opération archéologique associée à ce dossier" + +#: templates/ishtar/sheet_file.html:32 msgid "Year:" msgstr "Année :" -#: templates/ishtar/sheet_file.html:26 +#: templates/ishtar/sheet_file.html:33 msgid "Numerical reference:" msgstr "Référence numérique :" -#: templates/ishtar/sheet_file.html:27 +#: templates/ishtar/sheet_file.html:34 msgid "Other reference:" msgstr "Autre référence :" -#: templates/ishtar/sheet_file.html:29 +#: templates/ishtar/sheet_file.html:36 msgid "Name:" msgstr "Nom :" -#: templates/ishtar/sheet_file.html:31 +#: templates/ishtar/sheet_file.html:38 msgid "Edition date:" msgstr "Date d'édition :" -#: templates/ishtar/sheet_file.html:32 +#: templates/ishtar/sheet_file.html:39 msgid "Reception date:" msgstr "Date de réception :" -#: templates/ishtar/sheet_file.html:33 +#: templates/ishtar/sheet_file.html:40 msgid "Creation date:" msgstr "Date de création :" -#: templates/ishtar/sheet_file.html:34 +#: templates/ishtar/sheet_file.html:41 msgid "Created by:" msgstr "Créé par :" -#: templates/ishtar/sheet_file.html:41 +#: templates/ishtar/sheet_file.html:48 msgid "In charge:" msgstr "Responsable :" -#: templates/ishtar/sheet_file.html:42 +#: templates/ishtar/sheet_file.html:49 msgid "State:" msgstr "État :" -#: templates/ishtar/sheet_file.html:42 +#: templates/ishtar/sheet_file.html:49 msgid "Active file" msgstr "Dossier actif" -#: templates/ishtar/sheet_file.html:43 +#: templates/ishtar/sheet_file.html:50 msgid "Closed file" msgstr "Dossier fermé" -#: templates/ishtar/sheet_file.html:44 +#: templates/ishtar/sheet_file.html:51 msgid "Closing date:" -msgstr "Date de clôture :" +msgstr "Date de clotûre :" -#: templates/ishtar/sheet_file.html:44 +#: templates/ishtar/sheet_file.html:51 msgid "by" msgstr "par" -#: templates/ishtar/sheet_file.html:47 +#: templates/ishtar/sheet_file.html:54 msgid "Type:" msgstr "Type :" -#: templates/ishtar/sheet_file.html:49 +#: templates/ishtar/sheet_file.html:56 msgid "Related file:" msgstr "Dossier en relation avec :" -#: templates/ishtar/sheet_file.html:50 +#: templates/ishtar/sheet_file.html:57 msgid "Comment:" msgstr "Commentaire :" -#: templates/ishtar/sheet_file.html:52 +#: templates/ishtar/sheet_file.html:59 msgid "Localisation" msgstr "Localisation" -#: templates/ishtar/sheet_file.html:53 +#: templates/ishtar/sheet_file.html:60 msgid "Towns:" msgstr "Communes :" -#: templates/ishtar/sheet_file.html:55 +#: templates/ishtar/sheet_file.html:62 msgid "Main address:" msgstr "Adresse principale :" -#: templates/ishtar/sheet_file.html:56 +#: templates/ishtar/sheet_file.html:63 msgid "Complement:" msgstr "Complément :" -#: templates/ishtar/sheet_file.html:57 +#: templates/ishtar/sheet_file.html:64 msgid "Postal code:" msgstr "Code postal :" -#: templates/ishtar/sheet_file.html:59 +#: templates/ishtar/sheet_file.html:66 msgid "Surface:" msgstr "Surface :" -#: templates/ishtar/sheet_file.html:64 +#: templates/ishtar/sheet_file.html:71 msgid "Preventive archaelogical file" msgstr "Dossier d'archéologie préventive" -#: templates/ishtar/sheet_file.html:65 +#: templates/ishtar/sheet_file.html:72 msgid "Developed surface:" msgstr "Surface aménagée :" -#: templates/ishtar/sheet_file.html:66 +#: templates/ishtar/sheet_file.html:73 msgid "Saisine type:" msgstr "Type de saisine :" -#: templates/ishtar/sheet_file.html:67 +#: templates/ishtar/sheet_file.html:74 msgid "Town planning service:" msgstr "Service instructeur :" -#: templates/ishtar/sheet_file.html:68 +#: templates/ishtar/sheet_file.html:75 msgid "Permit type:" msgstr "Type de permis :" -#: templates/ishtar/sheet_file.html:69 +#: templates/ishtar/sheet_file.html:76 msgid "Permit reference:" msgstr "Référence du permis :" -#: templates/ishtar/sheet_file.html:70 +#: templates/ishtar/sheet_file.html:77 msgid "General contractor organisation:" -msgstr "Aménageur (organisation) :" +msgstr "Aménageur (organiation) :" -#: templates/ishtar/sheet_file.html:71 +#: templates/ishtar/sheet_file.html:78 msgid "General contractor:" msgstr "Aménageur :" -#: templates/ishtar/sheet_file.html:76 templates/ishtar/sheet_file.html:77 -#: templates/ishtar/sheet_file.html:78 templates/ishtar/sheet_file.html:79 -#: templates/ishtar/sheet_file.html:85 +#: templates/ishtar/sheet_file.html:83 templates/ishtar/sheet_file.html:84 +#: templates/ishtar/sheet_file.html:85 templates/ishtar/sheet_file.html:86 +#: templates/ishtar/sheet_file.html:92 #: templates/ishtar/dashboards/dashboard_file.html:14 msgid ":" msgstr " :" -#: templates/ishtar/sheet_file.html:77 +#: templates/ishtar/sheet_file.html:84 msgid "Head scientist" msgstr "Responsable scientifique" -#: templates/ishtar/sheet_file.html:89 +#: templates/ishtar/sheet_file.html:96 msgid "Associated parcels" msgstr "Opérations associées" -#: templates/ishtar/sheet_file.html:92 +#: templates/ishtar/sheet_file.html:99 msgid "Administrativ acts" -msgstr "Actes administratifs" +msgstr "Actes administratif" -#: templates/ishtar/sheet_file.html:99 templates/ishtar/sheet_file.html:127 +#: templates/ishtar/sheet_file.html:106 templates/ishtar/sheet_file.html:134 msgid "Ref." msgstr "Ref." -#: templates/ishtar/sheet_file.html:101 templates/ishtar/sheet_file.html:128 +#: templates/ishtar/sheet_file.html:108 templates/ishtar/sheet_file.html:135 msgid "Type" msgstr "Type" -#: templates/ishtar/sheet_file.html:103 +#: templates/ishtar/sheet_file.html:110 msgid "Start date" msgstr "Date de début" -#: templates/ishtar/sheet_file.html:104 +#: templates/ishtar/sheet_file.html:111 msgid "Excavation end date" msgstr "Date de fin de chantier" -#: templates/ishtar/sheet_file.html:116 +#: templates/ishtar/sheet_file.html:123 msgid "Details" msgstr "Détails" -#: templates/ishtar/sheet_file.html:119 +#: templates/ishtar/sheet_file.html:126 msgid "No operation associated to this archaelogical file" msgstr "Pas d'opération associée à ce dossier archéologique" -#: templates/ishtar/sheet_file.html:124 +#: templates/ishtar/sheet_file.html:131 msgid "Admninistrative acts linked to associated operations" -msgstr "Actes administratifs associés à ces opérations" +msgstr "Actes administratifs associé à ces opérations" -#: templates/ishtar/sheet_file.html:129 +#: templates/ishtar/sheet_file.html:136 msgid "Date" msgstr "Date" -#: templates/ishtar/sheet_file.html:139 +#: templates/ishtar/sheet_file.html:146 msgid "No administrative act linked to operations" msgstr "Pas d'acte administratif associé à ces opérations" @@ -697,9 +713,6 @@ msgstr "Principales communes en surface (ha)" #~ msgid "Creation date before" #~ msgstr "Date de création avant" -#~ msgid "Town" -#~ msgstr "Commune" - #~ msgid "Section" #~ msgstr "Section" diff --git a/archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py b/archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py new file mode 100644 index 000000000..f68da341d --- /dev/null +++ b/archaeological_files/migrations/0021_auto__chg_field_saisinetype_txt_idx__chg_field_filetype_txt_idx__del_f.py @@ -0,0 +1,442 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + for file in orm['archaeological_files.File'].objects.all(): + if file.towns.count() == 1: + file.main_town = file.towns.all()[0] + file.save() + + for file in orm['archaeological_files.File'].objects.all(): + address_comp = file.address_complement.strip() + if not address_comp: + continue + address = file.address.strip() + if address: + address += """ +""" + address += address_comp + file.address = address + file.save() + + # Changing field 'SaisineType.txt_idx' + db.alter_column('archaeological_files_saisinetype', 'txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)) + + # Changing field 'FileType.txt_idx' + db.alter_column('archaeological_files_filetype', 'txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)) + # Deleting field 'File.address_complement' + db.delete_column('archaeological_files_file', 'address_complement') + + # Adding field 'File.raw_general_contractor' + db.add_column('archaeological_files_file', 'raw_general_contractor', + self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True), + keep_default=False) + + # Adding field 'File.raw_town_planning_service' + db.add_column('archaeological_files_file', 'raw_town_planning_service', + self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True), + keep_default=False) + + # Adding field 'File.main_town' + db.add_column('archaeological_files_file', 'main_town', + self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='file_main', null=True, to=orm['ishtar_common.Town']), + keep_default=False) + + # Adding field 'File.instruction_deadline' + db.add_column('archaeological_files_file', 'instruction_deadline', + self.gf('django.db.models.fields.DateField')(null=True, blank=True), + keep_default=False) + + # Adding field 'File.locality' + db.add_column('archaeological_files_file', 'locality', + self.gf('django.db.models.fields.CharField')(max_length=100, null=True, blank=True), + keep_default=False) + + # Deleting field 'HistoricalFile.address_complement' + db.delete_column('archaeological_files_historicalfile', 'address_complement') + + # Adding field 'HistoricalFile.raw_general_contractor' + db.add_column('archaeological_files_historicalfile', 'raw_general_contractor', + self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True), + keep_default=False) + + # Adding field 'HistoricalFile.raw_town_planning_service' + db.add_column('archaeological_files_historicalfile', 'raw_town_planning_service', + self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True), + keep_default=False) + + # Adding field 'HistoricalFile.main_town_id' + db.add_column('archaeological_files_historicalfile', 'main_town_id', + self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True), + keep_default=False) + + # Adding field 'HistoricalFile.instruction_deadline' + db.add_column('archaeological_files_historicalfile', 'instruction_deadline', + self.gf('django.db.models.fields.DateField')(null=True, blank=True), + keep_default=False) + + # Adding field 'HistoricalFile.locality' + db.add_column('archaeological_files_historicalfile', 'locality', + self.gf('django.db.models.fields.CharField')(max_length=100, null=True, blank=True), + keep_default=False) + + + # Changing field 'PermitType.txt_idx' + db.alter_column('archaeological_files_permittype', 'txt_idx', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)) + + def backwards(self, orm): + + # Changing field 'SaisineType.txt_idx' + db.alter_column('archaeological_files_saisinetype', 'txt_idx', self.gf('django.db.models.fields.CharField')(max_length=30, unique=True)) + + # Changing field 'FileType.txt_idx' + db.alter_column('archaeological_files_filetype', 'txt_idx', self.gf('django.db.models.fields.CharField')(max_length=30, unique=True)) + # Adding field 'File.address_complement' + db.add_column('archaeological_files_file', 'address_complement', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Deleting field 'File.raw_general_contractor' + db.delete_column('archaeological_files_file', 'raw_general_contractor') + + # Deleting field 'File.raw_town_planning_service' + db.delete_column('archaeological_files_file', 'raw_town_planning_service') + + # Deleting field 'File.main_town' + db.delete_column('archaeological_files_file', 'main_town_id') + + # Deleting field 'File.instruction_deadline' + db.delete_column('archaeological_files_file', 'instruction_deadline') + + # Deleting field 'File.locality' + db.delete_column('archaeological_files_file', 'locality') + + # Adding field 'HistoricalFile.address_complement' + db.add_column('archaeological_files_historicalfile', 'address_complement', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Deleting field 'HistoricalFile.raw_general_contractor' + db.delete_column('archaeological_files_historicalfile', 'raw_general_contractor') + + # Deleting field 'HistoricalFile.raw_town_planning_service' + db.delete_column('archaeological_files_historicalfile', 'raw_town_planning_service') + + # Deleting field 'HistoricalFile.main_town_id' + db.delete_column('archaeological_files_historicalfile', 'main_town_id') + + # Deleting field 'HistoricalFile.instruction_deadline' + db.delete_column('archaeological_files_historicalfile', 'instruction_deadline') + + # Deleting field 'HistoricalFile.locality' + db.delete_column('archaeological_files_historicalfile', 'locality') + + + # Changing field 'PermitType.txt_idx' + db.alter_column('archaeological_files_permittype', 'txt_idx', self.gf('django.db.models.fields.CharField')(max_length=30, unique=True)) + + models = { + 'archaeological_files.file': { + 'Meta': {'ordering': "('cached_label',)", 'object_name': 'File'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'cira_advised': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'classified_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}), + 'departments': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'file_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}), + 'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'general_contractor'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imported_line': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_archaeological_files_file'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_responsability'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'instruction_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), + 'locality': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'main_town': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_main'", 'null': 'True', 'to': "orm['ishtar_common.Town']"}), + 'mh_listing': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'mh_register': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'numeric_reference': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'organization': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'files'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), + 'permit_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.PermitType']", 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'protected_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'raw_general_contractor': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'raw_town_planning_service': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'related_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']", 'null': 'True', 'blank': 'True'}), + 'requested_operation_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['archaeological_operations.OperationType']"}), + 'research_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'responsible_town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'responsible_town_planning_service'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", 'null': 'True', 'blank': 'True'}), + 'scientist': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'scientist'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Person']"}), + 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), + 'year': ('django.db.models.fields.IntegerField', [], {'default': '2015'}) + }, + 'archaeological_files.filebydepartment': { + 'Meta': {'object_name': 'FileByDepartment', 'db_table': "'file_department'", 'managed': 'False'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.File']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'archaeological_files.filetype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'FileType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_files.historicalfile': { + 'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalFile'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'cira_advised': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'classified_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'file_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'general_contractor_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_creator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'history_id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'history_modifier_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'history_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'history_user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), + 'id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'blank': 'True'}), + 'imported_line': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'instruction_deadline': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), + 'locality': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'main_town_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'mh_listing': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'mh_register': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'numeric_reference': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'organization_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'permit_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}), + 'permit_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'protected_area': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'raw_general_contractor': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'raw_town_planning_service': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'reception_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'reference_number': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'related_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'requested_operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'research_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'responsible_town_planning_service_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'saisine_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'scientist_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'total_developed_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'total_surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'year': ('django.db.models.fields.IntegerField', [], {'default': '2015'}) + }, + 'archaeological_files.permittype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'PermitType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_files.saisinetype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'SaisineType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'delay': ('django.db.models.fields.IntegerField', [], {'default': '30'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'archaeological_operations.operationtype': { + 'Meta': {'ordering': "['-preventive', 'order', 'label']", 'object_name': 'OperationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'ishtar_common.arrondissement': { + 'Meta': {'object_name': 'Arrondissement'}, + 'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.canton': { + 'Meta': {'object_name': 'Canton'}, + 'arrondissement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Arrondissement']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}) + }, + 'ishtar_common.department': { + 'Meta': {'ordering': "['number']", 'object_name': 'Department'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}), + 'state': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.State']", 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.import': { + 'Meta': {'object_name': 'Import'}, + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'error_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imported_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'importer_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.ImporterType']"}), + 'result_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'seconds_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'skip_lines': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'state': ('django.db.models.fields.CharField', [], {'default': "'C'", 'max_length': '2'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.IshtarUser']"}) + }, + 'ishtar_common.importertype': { + 'Meta': {'object_name': 'ImporterType'}, + 'associated_models': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_template': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'users': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.IshtarUser']", 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.ishtaruser': { + 'Meta': {'object_name': 'IshtarUser', '_ormbases': ['auth.User']}, + 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ishtaruser'", 'unique': 'True', 'to': "orm['ishtar_common.Person']"}), + 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'ishtar_common.organization': { + 'Meta': {'object_name': 'Organization'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_organization'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), + 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), + 'merge_key': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '300'}), + 'organization_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.OrganizationType']"}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.organizationtype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.person': { + 'Meta': {'object_name': 'Person'}, + 'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'attached_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ishtar_common.Organization']"}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'history_creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['auth.User']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'imports': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'imported_ishtar_common_person'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['ishtar_common.Import']"}), + 'merge_candidate': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_candidate_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'merge_exclusion': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'merge_exclusion_rel_+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), + 'merge_key': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'person_types': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.PersonType']", 'symmetrical': 'False'}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), + 'raw_name': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}), + 'surname': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}), + 'town': ('django.db.models.fields.CharField', [], {'max_length': '70', 'null': 'True', 'blank': 'True'}) + }, + 'ishtar_common.persontype': { + 'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'ishtar_common.state': { + 'Meta': {'ordering': "['number']", 'object_name': 'State'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '30'}), + 'number': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}) + }, + 'ishtar_common.town': { + 'Meta': {'ordering': "['numero_insee']", 'object_name': 'Town'}, + 'canton': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Canton']", 'null': 'True', 'blank': 'True'}), + 'center': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '27572', 'null': 'True', 'blank': 'True'}), + 'departement': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'numero_insee': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '6'}), + 'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['archaeological_files'] diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 9bdfc6146..4c9705641 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -46,7 +46,7 @@ class FileType(GeneralType): try: preventive = FileType.objects.get(txt_idx=key).pk return file_type_id == preventive - except ObjectDoesNotExist: + except FileType.DoesNotExist: return False class PermitType(GeneralType): @@ -57,7 +57,7 @@ class PermitType(GeneralType): if settings.COUNTRY == 'fr': class SaisineType(GeneralType, ValueGetter): - delay = models.IntegerField(_(u"Delay (in days)")) + delay = models.IntegerField(_(u"Delay (in days)"), default=30) class Meta: verbose_name = u"Type Saisine" verbose_name_plural = u"Types Saisine" @@ -83,16 +83,23 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, related_name='general_contractor', verbose_name=_(u"General contractor"), blank=True, null=True, on_delete=models.SET_NULL,) # aménageur + raw_general_contractor = models.CharField(_(u"General contractor (raw)"), + max_length=200, blank=True, null=True) responsible_town_planning_service = models.ForeignKey(Person, related_name='responsible_town_planning_service', blank=True, null=True, verbose_name=_(u"Responsible for town planning service"), on_delete=models.SET_NULL,) # service instructeur + raw_town_planning_service = models.CharField( + _(u"Town planning service (raw)"), max_length=200, + blank=True, null=True) permit_type = models.ForeignKey(PermitType, verbose_name=_(u"Permit type"), blank=True, null=True) permit_reference = models.CharField(_(u"Permit reference"), max_length=60, blank=True, null=True) end_date = models.DateField(_(u"Closing date"), null=True, blank=True) + main_town = models.ForeignKey(Town, verbose_name=_(u"Town"), null=True, + blank=True, related_name='file_main') towns = models.ManyToManyField(Town, verbose_name=_(u"Towns"), related_name='file') creation_date = models.DateField(_(u"Creation date"), @@ -106,13 +113,15 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, verbose_name= u"Type de saisine") reference_number = models.IntegerField(_(u"Ref. number"), blank=True, null=True) + instruction_deadline = models.DateField(_(u'Instruction deadline'), + blank=True, null=True) total_surface = models.IntegerField(_(u"Total surface (m²)"), blank=True, null=True) total_developed_surface = models.IntegerField( _(u"Total developed surface (m²)"), blank=True, null=True) + locality = models.CharField(_(u"Locality"), + max_length=100, null=True, blank=True) address = models.TextField(_(u"Main address"), null=True, blank=True) - address_complement = models.TextField(_(u"Main address - complement"), - null=True, blank=True) postal_code = models.CharField(_(u"Main address - postal code"), max_length=10, null=True, blank=True) comment = models.TextField(_(u"Comment"), null=True, blank=True) @@ -253,7 +262,7 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, @property def reference(self): - return u"-".join((unicode(self.year), + return settings.FILE_PREFIX+u"-".join((unicode(self.year), unicode(self.numeric_reference or '0'))) def _generate_cached_label(self): @@ -268,7 +277,9 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, def get_town_label(self): lbl = unicode(_('Intercommunal')) - if self.towns.count() == 1: + if self.main_town: + lbl = self.main_town.name + elif self.towns.count() == 1: lbl = self.towns.all()[0].name return lbl @@ -315,8 +326,43 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, acts.append(act) return acts + def update_raw_town_planning_service(self): + if (self.raw_town_planning_service and not \ + self.responsible_town_planning_service) or \ + not self.responsible_town_planning_service: + return False + current_lbl = "" + if self.raw_town_planning_service: + current_lbl = self.raw_town_planning_service[:] + lbl = unicode(self.responsible_town_planning_service) + if not lbl: + return False + self.raw_town_planning_service = lbl[:200] + return current_lbl != self.raw_town_planning_service + + def update_raw_general_contractor(self): + if (self.raw_general_contractor and not \ + self.general_contractor) or \ + not self.general_contractor: + return False + current_lbl = "" + if self.raw_general_contractor: + current_lbl = self.raw_general_contractor[:] + lbl = unicode(self.general_contractor) + if not lbl: + return False + self.raw_general_contractor = lbl[:200] + return current_lbl != self.raw_general_contractor + + def save(self, *args, **kwargs): returned = super(File, self).save(*args, **kwargs) + if self.main_town and not self.main_town in list(self.towns.all()): + self.towns.add(self.main_town) + updated = self.update_raw_town_planning_service() + updated += self.update_raw_general_contractor() + if updated: + self.save() self.update_delay_date() self.update_short_menu_class() return returned diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html index 11a90df9e..2d7b6262d 100644 --- a/archaeological_files/templates/ishtar/sheet_file.html +++ b/archaeological_files/templates/ishtar/sheet_file.html @@ -20,7 +20,14 @@ </div> {% endif %} <div class='tool'>{%trans "Export as:"%} <a href='{% url show-file item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-file item.pk "pdf" %}'>{%trans "PDF file"%}</a></div> +<hr/> <div class='tool modify'><a href='{% url file_modify item.pk %}'>{% trans "Modify" %}</a></div> + +{% if can_add_operation %} +<div class='tool modify'><a href='{% url operation_add item.pk %}'>{%trans "Add an associated archaeological operation"%}</a></div> + +{%endif%} + <h3>{% trans "General"%}</h3> <p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p> {% if item.numeric_reference %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value strong'>{{ item.numeric_reference }}</span></p>{% endif %} @@ -95,7 +102,6 @@ <table> <caption>{%trans "Associated operations"%}</caption> <tr> - <th>{% trans "Year" %}</th> <th>{% trans "Ref." %}</th> <th>Code Patriarche</th> <th>{% trans "Type" %}</th> @@ -106,9 +112,8 @@ </tr> {% for operation in item.operations.all %} <tr> - <td>{{operation.year}}</td> - <td>{{operation.operation_code}}</td> - <td>{{operation.code_patriarche|default:""}}</td> + <td>{{operation.year_index}}</td> + <td>{{operation.full_code_patriarche|default:""}}</td> <td class='string'>{{operation.operation_type}}</td> <td class='string'>{{operation.in_charge|default:""}}</td> <td>{{operation.start_date|default:""}}</td> diff --git a/archaeological_files/urls.py b/archaeological_files/urls.py index 694cb1791..f7f5cc7d5 100644 --- a/archaeological_files/urls.py +++ b/archaeological_files/urls.py @@ -23,6 +23,9 @@ import views # forms: urlpatterns = patterns('', + url(r'file_administrativeactfile_search/(?P<step>.+)?$', + views.file_administrativeactfile_search_wizard, + name='file_administrativeactfile_search'), url(r'file_administrativeactfile/(?P<step>.+)?$', views.file_administrativeactfile_wizard, name='file_administrativeactfile'), diff --git a/archaeological_files/views.py b/archaeological_files/views.py index ba640a785..942ee6ae3 100644 --- a/archaeological_files/views.py +++ b/archaeological_files/views.py @@ -28,6 +28,7 @@ from django.utils.translation import ugettext_lazy as _ from ishtar_common.views import get_item, show_item, revert_item from ishtar_common.models import Person +from archaeological_operations.models import Operation import models from ishtar_common.wizards import SearchWizard @@ -85,9 +86,17 @@ get_file = get_item(models.File, 'get_file', 'file', 'general_contractor__attached_to':'general_contractor__attached_to__pk', 'history_creator':'history_creator__ishtaruser__person__pk', },) -show_file = show_item(models.File, 'file') revert_file = revert_item(models.File) +def extra_file_dct(request, item): + dct = {} + if (request.user.has_perm('ishtar_common.add_operation', Operation) + or request.user.ishtaruser.has_right('add_operation')): + dct['can_add_operation'] = True + return dct + +show_file = show_item(models.File, 'file', extra_dct=extra_file_dct) + get_administrativeactfile = get_item(AdministrativeAct, 'get_administrativeactfile', 'administrativeactfile', associated_models = [(models.File, 'associated_file'), @@ -179,6 +188,12 @@ file_deletion_wizard = FileDeletionWizard.as_view([ label=_(u"File deletion"), url_name='file_deletion',) +file_administrativeactfile_search_wizard = SearchWizard.as_view([ + ('selec-file_administrativeactfile_search', + AdministrativeActFileFormSelection)], + label=_(u"File: search administrative act"), + url_name='file_administrativeactfile_search',) + file_administrativeactfile_wizard = FileAdministrativeActWizard.as_view([ ('selec-file_administrativeactfile', FileFormSelection), ('administrativeact-file_administrativeactfile', @@ -206,3 +221,16 @@ file_administrativeactfile_deletion_wizard = \ label=_(u"File: administrative act deletion"), url_name='file_administrativeactfile_deletion',) +def reset_wizards(request): + for wizard_class, url_name in ( + (FileWizard, 'file_creation'), + (FileModificationWizard, 'file_modification'), + (FileClosingWizard, 'file_modification'), + (FileDeletionWizard, 'file_deletion'), + (FileAdministrativeActWizard, 'file_administrativeactfile'), + (FileEditAdministrativeActWizard, + 'file_administrativeactfile_modification_wizard'), + (AdministrativeActDeletionWizard, + 'file_administrativeactfile_deletion_wizard'), + ): + wizard_class.session_reset(request, url_name) diff --git a/archaeological_files/wizards.py b/archaeological_files/wizards.py index d8c137dfa..26dc90f21 100644 --- a/archaeological_files/wizards.py +++ b/archaeological_files/wizards.py @@ -38,8 +38,10 @@ class FileWizard(OperationWizard): model = models.File object_parcel_type = 'associated_file' parcel_step_key = 'parcels-' + town_step_keys = ['towns-'] wizard_done_window = reverse_lazy('show-file') + ''' def get_form(self, step=None, data=None, files=None): """ Manage towns @@ -53,8 +55,10 @@ class FileWizard(OperationWizard): # step = self.determine_step(request, storage) step = self.steps.current form = self.get_form_list()[step] - town_form_key = 'towns-' + self.url_name - if step.startswith('parcels-') and hasattr(form, 'management_form') \ + town_form_key = self.town_step_key + town_form_key += self.url_name + if step.startswith(self.parcel_step_key) \ + and hasattr(form, 'management_form') \ and self.session_has_key(town_form_key): towns = [] qdict = self.request.session[self.storage.prefix]['step_data']\ @@ -68,7 +72,9 @@ class FileWizard(OperationWizard): pass data['TOWNS'] = sorted(towns, key=lambda x:x[1]) form = super(FileWizard, self).get_form(step, data, files) + """ return form + ''' def get_extra_model(self, dct, form_list): dct = super(FileWizard, self).get_extra_model(dct, form_list) |