diff options
22 files changed, 1468 insertions, 405 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index ec9409ef6..a4a20938b 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -194,28 +194,6 @@ class FinalFileDeleteForm(FinalForm):      confirm_msg = " "      confirm_end_msg = _(u"Would you like to delete this archaelogical file ?") -class DocumentGenerationAdminActForm(forms.Form): -    _associated_model = AdministrativeAct -    document_template = forms.ChoiceField(label=_("Template"), choices=[]) - -    def __init__(self, *args, **kwargs): -        super(DocumentGenerationAdminActForm, self).__init__(*args, **kwargs) -        self.fields['document_template'].choices = DocumentTemplate.get_tuples( -                    dct={'associated_object_name': -                         'archaeological_operations.models.AdministrativeAct'}) - -    def save(self, object_pk): -        try: -            c_object = self._associated_model.objects.get(pk=object_pk) -        except self._associated_model.DoesNotExist: -            return -        try: -            template = DocumentTemplate.objects.get( -                            pk=self.cleaned_data.get('document_template')) -        except DocumentTemplate.DoesNotExist: -            return -        return template.publish(c_object) -  class AdministrativeActFileSelect(TableSelect):      associated_file__towns = get_town_field()      act_type = forms.ChoiceField(label=_("Act type"), choices=[]) diff --git a/archaeological_files/locale/fr/LC_MESSAGES/django.po b/archaeological_files/locale/fr/LC_MESSAGES/django.po index 0dda70bec..46c24adbb 100644 --- a/archaeological_files/locale/fr/LC_MESSAGES/django.po +++ b/archaeological_files/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid ""  msgstr ""  "Project-Id-Version: alpha\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 20:04+0100\n" +"POT-Creation-Date: 2013-12-02 20:32+0100\n"  "PO-Revision-Date: 2010-12-09\n"  "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n"  "Language-Team: \n" @@ -133,15 +133,19 @@ msgstr "Surface totale aménagée (m²)"  msgid "Reception date"  msgstr "Date de réception" -#: forms.py:191 +#: forms.py:190  msgid "Would you like to close this archaeological file?"  msgstr "Voulez vous clore ce dossier archéologique ?" -#: forms.py:196 +#: forms.py:194  msgid "Would you like to delete this archaelogical file ?"  msgstr "Voulez vous supprimer ce dossier archéologique ?" -#: forms.py:200 forms.py:217 +#: forms.py:198 +msgid "Template" +msgstr "Patron" + +#: forms.py:220 forms.py:237  msgid "Act type"  msgstr "Type d'acte" @@ -177,15 +181,19 @@ msgstr "Acte administratif"  msgid "Add"  msgstr "Ajout" -#: ishtar_menu.py:66 +#: ishtar_menu.py:64 +msgid "Documents" +msgstr "Documents" + +#: ishtar_menu.py:70  msgid "Dashboard"  msgstr "Tableau de bord" -#: ishtar_menu.py:68 +#: ishtar_menu.py:72  msgid "General informations"  msgstr "Informations générales" -#: ishtar_menu.py:71 models.py:115 +#: ishtar_menu.py:75 models.py:115  #: templates/ishtar/dashboards/dashboard_file.html:8  msgid "Archaeological files"  msgstr "Dossiers archéologiques" @@ -246,47 +254,47 @@ msgstr "Peut supprimer son propre Dossier archéologique"  msgid "FILE"  msgstr "DOSSIER" -#: models.py:168 +#: models.py:176  msgid "Intercommunal"  msgstr "Intercommunal" -#: models.py:224 +#: models.py:232  msgid "File"  msgstr "Dossier" -#: models.py:225 +#: models.py:233  msgid "Department"  msgstr "Département" -#: views.py:87 +#: views.py:89  msgid "File search"  msgstr "Recherche de dossier archéologique" -#: views.py:96 +#: views.py:98  msgid "New file"  msgstr "Nouveau dossier archéologique" -#: views.py:111 +#: views.py:113  msgid "File modification"  msgstr "Modification de dossier archéologique" -#: views.py:122 +#: views.py:124  msgid "File closing"  msgstr "Clotûre de dossier" -#: views.py:129 +#: views.py:131  msgid "File deletion"  msgstr "Suppression de dossier archéologique" -#: views.py:137 +#: views.py:139  msgid "File: new administrative act"  msgstr "Dossier archéologique : nouvel acte administratif" -#: views.py:147 +#: views.py:149  msgid "File: administrative act modification"  msgstr "Dossier archéologique : modification d'acte administratif" -#: views.py:156 +#: views.py:158  msgid "File: administrative act deletion"  msgstr "Dossier archéologique : suppression acte administratif" @@ -294,6 +302,18 @@ msgstr "Dossier archéologique : suppression acte administratif"  msgid "Associated operations"  msgstr "Opérations associées" +#: templates/ishtar/administrativeact_document.html:9 +msgid "Document generation" +msgstr "Génération de document" + +#: templates/ishtar/administrativeact_document.html:15 +msgid "Choose the type of document" +msgstr "Choisir le type de document" + +#: templates/ishtar/administrativeact_document.html:19 +msgid "Generate" +msgstr "Générer" +  #: templates/ishtar/sheet_file.html:13  msgid "Previous version"  msgstr "Version précédente" diff --git a/archaeological_files/templates/ishtar/administrativeact_document.html b/archaeological_files/templates/ishtar/administrativeact_document.html index cdb2b45be..8c08519de 100644 --- a/archaeological_files/templates/ishtar/administrativeact_document.html +++ b/archaeological_files/templates/ishtar/administrativeact_document.html @@ -12,10 +12,6 @@  <table>  {{ search_form.as_table }}  </table> -<h4>{% trans "Choose the type of document" %}</h4> -<table> -{{ template_form }} -</table>  <input type="submit" id="submit_form" name='validate' value="{% trans "Generate" %}"/>  </div>  </form> diff --git a/archaeological_files/views.py b/archaeological_files/views.py index e55368e62..699335a56 100644 --- a/archaeological_files/views.py +++ b/archaeological_files/views.py @@ -18,12 +18,10 @@  # See the file COPYING for details.  import json -import os  from django.db.models import Q  from django.http import HttpResponse  from django.shortcuts import render_to_response -from django.template.defaultfilters import slugify  from django.utils.translation import ugettext_lazy as _  from ishtar_common.views import get_item, show_item, revert_item @@ -36,6 +34,8 @@ from ishtar_common.forms_common import TownFormset  from archaeological_operations.forms import ParcelFormSet  from forms import * +from archaeological_operations.views import generatedoc_administrativeactop +  def autocomplete_file(request):      if not request.user.has_perm('ishtar_common.view_file', models.File) and \         not request.user.has_perm('ishtar_common.view_own_file', models.File) \ @@ -162,25 +162,10 @@ def file_administrativeactfile_document(request):      dct = {}      if request.POST:          dct['search_form'] = AdministrativeActFileFormSelection(request.POST) -        dct['template_form'] = DocumentGenerationAdminActForm(request.POST) -        if dct['search_form'].is_valid() and dct['template_form'].is_valid(): -            doc = dct['template_form'].save( -                                dct['search_form'].cleaned_data.get('pk')) -            if doc: -                MIMES = {'odt':'application/vnd.oasis.opendocument.text', -                         'ods':'application/vnd.oasis.opendocument.spreadsheet'} -                ext = doc.split('.')[-1] -                doc_name = slugify(doc.split(os.path.sep)[-1][:-len(ext)])+ "."\ -                                                                          + ext -                mimetype = 'text/csv' -                if ext in MIMES: -                    mimetype = MIMES[ext] -                response = HttpResponse(open(doc), mimetype=mimetype) -                response['Content-Disposition'] = 'attachment; filename=%s' % \ -                                                                        doc_name -                return response +        if dct['search_form'].is_valid(): +            return generatedoc_administrativeactop(request, +                        dct['search_form'].cleaned_data.get('pk'))      else:          dct['search_form'] = AdministrativeActFileFormSelection() -        dct['template_form'] = DocumentGenerationAdminActForm()      return render_to_response('ishtar/administrativeact_document.html', dct,                                context_instance=RequestContext(request)) diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 50a5e7f5f..955b2f825 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -613,3 +613,7 @@ class FinalAdministrativeActDeleteForm(FinalForm):      confirm_msg = " "      confirm_end_msg = _(u"Would you like to delete this administrative act?") +class GenerateDocForm(forms.Form): +    form_label = _("Doc generation") +    doc_generation = forms.BooleanField(required=False, +                        label=_(u"Generate the associated doc?")) diff --git a/archaeological_operations/locale/fr/LC_MESSAGES/django.po b/archaeological_operations/locale/fr/LC_MESSAGES/django.po index d217eccf3..7cb55c4bb 100644 --- a/archaeological_operations/locale/fr/LC_MESSAGES/django.po +++ b/archaeological_operations/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid ""  msgstr ""  "Project-Id-Version: alpha\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 01:40+0100\n" +"POT-Creation-Date: 2013-12-05 01:35+0100\n"  "PO-Revision-Date: 2010-12-09\n"  "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n"  "Language-Team: \n" @@ -18,12 +18,12 @@ msgstr ""  "Content-Transfer-Encoding: 8bit\n"  "Plural-Forms: nplurals=2; plural=n>1;\n" -#: forms.py:62 forms.py:185 forms.py:416 forms.py:437 forms.py:441 -#: models.py:387 templates/ishtar/sheet_operation.html:78 +#: forms.py:62 forms.py:187 forms.py:420 forms.py:441 forms.py:445 +#: models.py:449 templates/ishtar/sheet_operation.html:84  msgid "Parcels"  msgstr "Parcelles" -#: forms.py:65 forms.py:394 models.py:381 +#: forms.py:65 forms.py:398 models.py:443  #: templates/ishtar/dashboards/dashboard_operation.html:302  #: templates/ishtar/dashboards/dashboard_operation.html:315  #: templates/ishtar/dashboards/dashboard_operation.html:482 @@ -31,17 +31,17 @@ msgstr "Parcelles"  msgid "Town"  msgstr "Commune" -#: forms.py:67 forms.py:203 forms.py:299 models.py:87 models.py:379 -#: templates/ishtar/sheet_operation.html:76 -#: templates/ishtar/sheet_operation.html:97 +#: forms.py:67 forms.py:205 forms.py:303 models.py:91 models.py:441 +#: templates/ishtar/sheet_operation.html:82 +#: templates/ishtar/sheet_operation.html:103  msgid "Year"  msgstr "Année" -#: forms.py:70 models.py:382 templates/ishtar/sheet_operation.html:77 +#: forms.py:70 models.py:444 templates/ishtar/sheet_operation.html:83  msgid "Section"  msgstr "Section" -#: forms.py:72 models.py:383 +#: forms.py:72 models.py:445  msgid "Parcel number"  msgstr "Numéro de parcelle" @@ -57,115 +57,119 @@ msgstr "Saisie libre"  msgid "example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or \"AB:24,AC:42\""  msgstr "exemple : \"2013: XD:1 à 13,24,33 à 39, YD:24\" ou \"AB:24,AC:42\"" -#: forms.py:179 +#: forms.py:181  msgid "There are identical parcels."  msgstr "Il y a des parcelles identiques." -#: forms.py:188 +#: forms.py:190  msgid "Name (full text search)"  msgstr "Nom (recherche texte intégral)" -#: forms.py:193 forms.py:289 forms.py:536 models.py:41 models.py:94 +#: forms.py:195 forms.py:291 forms.py:540 models.py:43 models.py:98  msgid "Operation type"  msgstr "Type d'opération" -#: forms.py:200 models.py:85 +#: forms.py:202 models.py:89  msgid "In charge"  msgstr "Responsable" -#: forms.py:201 models.py:96 +#: forms.py:203 models.py:100  msgid "Remains"  msgstr "Vestiges" -#: forms.py:202 forms.py:466 forms.py:485 models.py:99 -#: templates/ishtar/sheet_operation.html:166 +#: forms.py:204 forms.py:470 forms.py:489 models.py:103 +#: templates/ishtar/sheet_operation.html:158  msgid "Periods"  msgstr "Périodes" -#: forms.py:204 +#: forms.py:206  msgid "Started before"  msgstr "Commencé avant" -#: forms.py:206 +#: forms.py:208  msgid "Started after"  msgstr "Commencé après" -#: forms.py:208 +#: forms.py:210  msgid "Ended before"  msgstr "Terminé avant" -#: forms.py:210 +#: forms.py:212  msgid "Ended after"  msgstr "Terminé après" -#: forms.py:212 +#: forms.py:214  msgid "Parcel (section/number)"  msgstr "Parcelle (section/numéro)" -#: forms.py:213 +#: forms.py:215  msgid "Is open?"  msgstr "Est ouvert ?" -#: forms.py:232 forms.py:530 views.py:134 +#: forms.py:234 forms.py:534 views.py:136  msgid "Operation search"  msgstr "Recherche d'opérations" -#: forms.py:244 forms.py:532 +#: forms.py:246 forms.py:536  msgid "You should select an operation."  msgstr "Vous devez sélectionner une opération." -#: forms.py:272 forms.py:586 templates/ishtar/sheet_operation.html:20 +#: forms.py:274 forms.py:590 templates/ishtar/sheet_operation.html:26  msgid "General"  msgstr "Général" -#: forms.py:278 models.py:330 +#: forms.py:280 models.py:371  msgid "Person in charge of the operation"  msgstr "Responsable d'opération" -#: forms.py:285 models.py:190 models.py:313 models.py:343 +#: forms.py:287 models.py:351 models.py:384 wizards.py:78  msgid "Archaelogical file"  msgstr "Dossier archéologique" -#: forms.py:291 models.py:63 models.py:80 models.py:433 +#: forms.py:293 models.py:65 models.py:82 models.py:495  msgid "Start date"  msgstr "Date de début" -#: forms.py:293 models.py:81 +#: forms.py:295 models.py:83  msgid "Excavation end date"  msgstr "Date de fin de chantier" -#: forms.py:296 +#: forms.py:297 models.py:86 +msgid "Report delivery date" +msgstr "Date de livraison du rapport" + +#: forms.py:300  msgid "Total surface (m²)"  msgstr "Surface totale des terrains (m²)" -#: forms.py:303 models.py:88 models.py:218 +#: forms.py:307 models.py:92 models.py:252  msgid "Operation code"  msgstr "Code de l'opération" -#: forms.py:306 models.py:131 +#: forms.py:310 models.py:135  msgid "Generic name"  msgstr "Nom générique" -#: forms.py:308 models.py:129 +#: forms.py:312 models.py:133  msgid "Operator reference"  msgstr "Référence de l'opérateur" -#: forms.py:328 models.py:133 +#: forms.py:332 models.py:137  msgid "Comment"  msgstr "Commentaire" -#: forms.py:341 +#: forms.py:345  msgid ""  "If you want to set an excavation end date you have to provide a start date."  msgstr ""  "Avant de renseigner la date de fin de chantier, il est nécessaire de "  "renseigner une date de début." -#: forms.py:344 +#: forms.py:348  msgid "The excavation end date cannot be before the start date."  msgstr "La date de fin de chantier ne peut être avant la date de début." -#: forms.py:358 +#: forms.py:362  #, python-format  msgid ""  "Operation code already exist for year: %(year)d - use a value bigger than " @@ -174,90 +178,90 @@ msgstr ""  "Ce code d'opération existe déjà pour l'année %(year)d - utilisez une valeur "  "plus grande que %(last_val)d" -#: forms.py:362 +#: forms.py:366  msgid "Bad operation code"  msgstr "Mauvais code d'opération" -#: forms.py:367 +#: forms.py:371  msgid "Preventive informations - excavation"  msgstr "Information archéologie préventive - fouille" -#: forms.py:368 models.py:98 +#: forms.py:372 models.py:102  #: templates/ishtar/dashboards/dashboard_operation.html:495  msgid "Cost (€)"  msgstr "Cout (€)" -#: forms.py:369 models.py:100 +#: forms.py:373 models.py:104  msgid "Scheduled man-days"  msgstr "Jours-hommes prévus" -#: forms.py:371 models.py:102 +#: forms.py:375 models.py:106  msgid "Optional man-days"  msgstr "Jours-hommes optionnels" -#: forms.py:373 models.py:104 +#: forms.py:377 models.py:108  msgid "Effective man-days"  msgstr "Jours-hommes effectifs" -#: forms.py:382 +#: forms.py:386  msgid "Preventive informations - diagnostic"  msgstr "Information archéologie préventive - diagnostic" -#: forms.py:385 models.py:117 +#: forms.py:389 models.py:121  msgid "Prescription on zoning"  msgstr "Prescription sur zonage" -#: forms.py:387 models.py:119 +#: forms.py:391 models.py:123  msgid "Prescription on large area"  msgstr "Prescription sur une vaste surface" -#: forms.py:389 models.py:121 +#: forms.py:393 models.py:125  msgid "Prescription on geoarchaeological context"  msgstr "Prescription sur un contexte géoarchéologique" -#: forms.py:392 forms.py:413 models.py:97 +#: forms.py:396 forms.py:417 models.py:101  msgid "Towns"  msgstr "Communes" -#: forms.py:418 models.py:386 models.py:432 -#: templates/ishtar/sheet_operation.html:142 -#: templates/ishtar/sheet_operation.html:170 +#: forms.py:422 models.py:448 models.py:494 +#: templates/ishtar/sheet_operation.html:130 +#: templates/ishtar/sheet_operation.html:162  msgid "Parcel"  msgstr "Parcelle" -#: forms.py:444 forms.py:463 models.py:58 +#: forms.py:448 forms.py:467 models.py:60  msgid "Remain types"  msgstr "Types de vestige" -#: forms.py:447 models.py:57 +#: forms.py:451 models.py:59  msgid "Remain type"  msgstr "Type de vestige" -#: forms.py:459 +#: forms.py:463  msgid "There are identical remain types"  msgstr "Il y a des types de vestige identiques." -#: forms.py:469 +#: forms.py:473  msgid "Period"  msgstr "Période" -#: forms.py:481 +#: forms.py:485  msgid "There are identical periods"  msgstr "Il y a des périodes identiques." -#: forms.py:489 +#: forms.py:493  msgid "Would you like to close this operation?"  msgstr "Voulez vous clore cette opération ?" -#: forms.py:493 +#: forms.py:497  msgid "Would you like to delete this operation?"  msgstr "Voulez vous supprimer cette opération ?" -#: forms.py:501 models.py:308 +#: forms.py:505 models.py:342  msgid "Index"  msgstr "Index" -#: forms.py:524 +#: forms.py:528  #, python-format  msgid ""  "Index already exist for operation: %(operation)s - use a value bigger than " @@ -266,52 +270,60 @@ msgstr ""  "Cet index existe déjà pour l'opération : %(operation)s, utilisez une valeur "  "plus grande que %(last_val)d" -#: forms.py:535 +#: forms.py:539  msgid "Operation's town"  msgstr "Commune de l'opération" -#: forms.py:538 +#: forms.py:542  msgid "Operation's year"  msgstr "Année de l'opération" -#: forms.py:549 +#: forms.py:553  msgid "Documentation search"  msgstr "Recherche de document" -#: forms.py:551 +#: forms.py:555  msgid "You should select a document."  msgstr "Vous devez sélectionner un document." -#: forms.py:559 forms.py:589 models.py:319 models.py:328 +#: forms.py:563 forms.py:593 models.py:360 models.py:369  msgid "Act type"  msgstr "Type d'acte" -#: forms.py:569 +#: forms.py:573  msgid "Administrative act search"  msgstr "Recherche d'actes administratifs" -#: forms.py:581 +#: forms.py:585  msgid "You should select an administrative act."  msgstr "Vous devez sélectionner un acte administratif." -#: forms.py:590 models.py:337 +#: forms.py:594 models.py:378  msgid "Signatory"  msgstr "Signataire" -#: forms.py:594 models.py:346 +#: forms.py:598 models.py:387  msgid "Object"  msgstr "Objet" -#: forms.py:596 models.py:344 +#: forms.py:600 models.py:385  msgid "Signature date"  msgstr "Date de signature" -#: forms.py:610 +#: forms.py:614  msgid "Would you like to delete this administrative act?"  msgstr "Voulez vous supprimer cet acte administratif ?" -#: ishtar_menu.py:27 models.py:139 models.py:295 models.py:306 models.py:314 -#: models.py:339 models.py:378 +#: forms.py:617 +msgid "Doc generation" +msgstr "Generation de document" + +#: forms.py:619 +msgid "Generate the associated doc?" +msgstr "Générer le document associé ?" + +#: ishtar_menu.py:27 models.py:143 models.py:329 models.py:340 models.py:352 +#: models.py:380 models.py:440 templates/ishtar/sheet_operation.html:6  msgid "Operation"  msgstr "Opération" @@ -335,7 +347,7 @@ msgstr "Clotûre"  msgid "Deletion"  msgstr "Suppression" -#: ishtar_menu.py:51 models.py:353 +#: ishtar_menu.py:51 models.py:395  msgid "Administrative act"  msgstr "Acte administratif" @@ -355,223 +367,235 @@ msgstr "Tableau de bord"  msgid "General informations"  msgstr "Informations générales" -#: ishtar_menu.py:94 models.py:140 +#: ishtar_menu.py:94 models.py:144  #: templates/ishtar/dashboards/dashboard_operation.html:9  msgid "Operations"  msgstr "Opérations" -#: models.py:39 +#: models.py:41  msgid "Is preventive"  msgstr "Préventif" -#: models.py:42 +#: models.py:44  msgid "Operation types"  msgstr "Types d'opération" -#: models.py:62 +#: models.py:64  msgid "Order"  msgstr "Ordre" -#: models.py:64 models.py:434 +#: models.py:66 models.py:496  msgid "End date"  msgstr "Date de fin" -#: models.py:65 +#: models.py:67  msgid "Parent period"  msgstr "Période parente" -#: models.py:69 +#: models.py:71  msgid "Type Period"  msgstr "Type de période" -#: models.py:70 +#: models.py:72  msgid "Types Period"  msgstr "Types de période" -#: models.py:83 +#: models.py:85  msgid "Closing date"  msgstr "Date de clotûre" -#: models.py:92 models.py:376 +#: models.py:96 models.py:438  msgid "File"  msgstr "Dossier" -#: models.py:95 +#: models.py:99  msgid "Surface (m²)"  msgstr "Area (m²)" -#: models.py:134 +#: models.py:138  msgid "Cached name"  msgstr "Nom en cache" -#: models.py:142 +#: models.py:146  msgid "Can view all Operation"  msgstr "Peut voir toutes les Opérations" -#: models.py:143 +#: models.py:147  msgid "Can view own Operation"  msgstr "Peut voir sa propre Opération" -#: models.py:144 +#: models.py:148  msgid "Can add own Operation"  msgstr "Peut ajouter sa propre Opération" -#: models.py:145 +#: models.py:149  msgid "Can change own Operation"  msgstr "Peut changer sa propre Opération" -#: models.py:146 +#: models.py:150  msgid "Can delete own Operation"  msgstr "Peut supprimer sa propre Opération" -#: models.py:157 +#: models.py:161  msgid "OPE"  msgstr "OPE" -#: models.py:176 +#: models.py:198  msgid "Intercommunal"  msgstr "Intercommunal" -#: models.py:233 +#: models.py:224 +msgid "Archaeological file" +msgstr "Dossier archéologique" + +#: models.py:267  msgid "This operation code already exists for this year"  msgstr "Cet code d'opération existe déjà pour cette année." -#: models.py:296 templates/ishtar/dashboards/dashboard_operation.html:273 +#: models.py:330 templates/ishtar/dashboards/dashboard_operation.html:273  #: templates/ishtar/dashboards/dashboard_operation.html:286  #: templates/ishtar/dashboards/dashboard_operation.html:453  #: templates/ishtar/dashboards/dashboard_operation.html:466  msgid "Department"  msgstr "Département" -#: models.py:304 +#: models.py:338  msgid "Operation documentation"  msgstr "Documentation d'une opération" -#: models.py:305 +#: models.py:339  msgid "Operation documentations"  msgstr "Documentations des opérations" -#: models.py:316 +#: models.py:354  msgid "Intended to"  msgstr "Destiné à" -#: models.py:320 +#: models.py:356 +msgid "Code" +msgstr "Code" + +#: models.py:358 +msgid "Associated template" +msgstr "Patron associé" + +#: models.py:361  msgid "Act types"  msgstr "Types d'acte" -#: models.py:332 +#: models.py:373  msgid "Archaeological preventive operator"  msgstr "Opérateur d'archéologie préventive" -#: models.py:335 +#: models.py:376  msgid "Person in charge of the scientific part"  msgstr "Responsable scientifique" -#: models.py:354 templates/ishtar/sheet_operation.html:95 +#: models.py:396 templates/ishtar/sheet_operation.html:101  msgid "Administrative acts"  msgstr "Actes administratifs" -#: models.py:357 +#: models.py:399  msgid "Can view all Administrative act"  msgstr "Peut voir tout les Actes administratifs" -#: models.py:359 +#: models.py:401  msgid "Can view own Administrative act"  msgstr "Peut voir son propre Acte administratif" -#: models.py:361 +#: models.py:403  msgid "Can add own Administrative act"  msgstr "Peut ajouter son propre Acte administratif" -#: models.py:363 +#: models.py:405  msgid "Can change own Administrative act"  msgstr "Peut changer son propre Acte administratif" -#: models.py:365 +#: models.py:407  msgid "Can delete own Administrative act"  msgstr "Peut supprimer son propre Acte administratif" -#: models.py:431 +#: models.py:493  msgid "Owner"  msgstr "Propriétaire" -#: models.py:437 +#: models.py:499  msgid "Parcel owner"  msgstr "Propriétaire de parcelle" -#: models.py:438 +#: models.py:500  msgid "Parcel owners"  msgstr "Propriétaires de parcelle" -#: models.py:462 +#: models.py:524  msgid "Recorded"  msgstr "Enregistré" -#: models.py:463 +#: models.py:525  msgid "Effective"  msgstr "Effectif" -#: models.py:464 +#: models.py:526  msgid "Active"  msgstr "Actif" -#: models.py:465 +#: models.py:527  msgid "Field completed"  msgstr "Terrain achevé" -#: models.py:466 +#: models.py:528  msgid "Associated report"  msgstr "Rapport associé" -#: models.py:467 +#: models.py:529  msgid "Closed"  msgstr "Fermé" -#: models.py:468 +#: models.py:530  msgid "Documented and closed"  msgstr "Documenté et clôt" -#: views.py:148 +#: views.py:150  msgid "New operation"  msgstr "Nouvelle opération" -#: views.py:179 +#: views.py:181  msgid "Operation modification"  msgstr "Modification d'une opération" -#: views.py:202 +#: views.py:204  msgid "Operation closing"  msgstr "Clotûre de l'opération" -#: views.py:208 +#: views.py:210  msgid "Operation deletion"  msgstr "Suppression d'une opération" -#: views.py:216 +#: views.py:218  msgid "Operation: source creation"  msgstr "Operation : nouvelle documentation associée" -#: views.py:224 +#: views.py:226  msgid "Operation: source modification"  msgstr "Operation : modification d'une documentation associée" -#: views.py:230 +#: views.py:232  msgid "Operation: source deletion"  msgstr "Operation : suppression d'une documentation associée" -#: views.py:239 +#: views.py:241  msgid "Operation: new administrative act"  msgstr "Operation : nouvel acte administratif" -#: views.py:249 +#: views.py:251  msgid "Operation: administrative act modification"  msgstr "Operation : modification d'un acte administratif" -#: views.py:258 +#: views.py:260  msgid "Operation: administrative act deletion"  msgstr "Operation : suppression d'un acte administratif" -#: wizards.py:142 +#: wizards.py:158  msgid ""  "Warning: No Archaelogical File is provided. If you have forget it return to "  "the first step." @@ -579,293 +603,279 @@ msgstr ""  "Attention : Aucun dossier archéologique n'a été précisé. S'il s'agit d'un "  "oubli, définissez le à la première étape." -#: templates/ishtar/sheet_operation.html:8 +#: templates/ishtar/sheet_operation.html:14  msgid "Previous version"  msgstr "Version précédente" -#: templates/ishtar/sheet_operation.html:12 +#: templates/ishtar/sheet_operation.html:18  msgid "Are you sure to rollback to this version?"  msgstr "Êtes vous sûr de vouloir revenir à cette version ?" -#: templates/ishtar/sheet_operation.html:13 +#: templates/ishtar/sheet_operation.html:19  msgid "Next version"  msgstr "Version suivante" -#: templates/ishtar/sheet_operation.html:18 +#: templates/ishtar/sheet_operation.html:24  msgid "Export as:"  msgstr "Exporter en :" -#: templates/ishtar/sheet_operation.html:18 +#: templates/ishtar/sheet_operation.html:24  msgid "OpenOffice.org file"  msgstr "Fichier OpenOffice.org" -#: templates/ishtar/sheet_operation.html:18 +#: templates/ishtar/sheet_operation.html:24  msgid "PDF file"  msgstr "Fichier PDF" -#: templates/ishtar/sheet_operation.html:21 +#: templates/ishtar/sheet_operation.html:27  msgid "Name:"  msgstr "Nom :" -#: templates/ishtar/sheet_operation.html:22 +#: templates/ishtar/sheet_operation.html:28  msgid "Year:"  msgstr "Année :" -#: templates/ishtar/sheet_operation.html:23 +#: templates/ishtar/sheet_operation.html:29  msgid "Numerical reference:"  msgstr "Identifiant numérique :" -#: templates/ishtar/sheet_operation.html:25 +#: templates/ishtar/sheet_operation.html:31  msgid "Patriarche OA code:"  msgstr "Code d'opération Patriarche" -#: templates/ishtar/sheet_operation.html:26 +#: templates/ishtar/sheet_operation.html:32  msgid "Patriarche OA code not yet recorded!"  msgstr "Code d'opération Patriarche non renseigné !" -#: templates/ishtar/sheet_operation.html:28 +#: templates/ishtar/sheet_operation.html:34  msgid "Edition date:"  msgstr "Date d'édition :" -#: templates/ishtar/sheet_operation.html:30 +#: templates/ishtar/sheet_operation.html:36  msgid "Begining date:"  msgstr "Date de début :" -#: templates/ishtar/sheet_operation.html:31 +#: templates/ishtar/sheet_operation.html:37  msgid "Excavation end date:"  msgstr "Date de fin de chantier :" -#: templates/ishtar/sheet_operation.html:33 +#: templates/ishtar/sheet_operation.html:39  msgid "Head scientist:"  msgstr "Responsable scientifique :" -#: templates/ishtar/sheet_operation.html:34 +#: templates/ishtar/sheet_operation.html:40  msgid "State:"  msgstr "État :" -#: templates/ishtar/sheet_operation.html:34 +#: templates/ishtar/sheet_operation.html:40  msgid "Active file"  msgstr "Dossier archéologique actif" -#: templates/ishtar/sheet_operation.html:35 +#: templates/ishtar/sheet_operation.html:41  msgid "Closed operation"  msgstr "Opération fermée" -#: templates/ishtar/sheet_operation.html:36 +#: templates/ishtar/sheet_operation.html:42  msgid "Closing date:"  msgstr "Date de clotûre :" -#: templates/ishtar/sheet_operation.html:36 +#: templates/ishtar/sheet_operation.html:42  msgid "by"  msgstr "par" -#: templates/ishtar/sheet_operation.html:38 +#: templates/ishtar/sheet_operation.html:44  msgid "Type:"  msgstr "Type :" -#: templates/ishtar/sheet_operation.html:39 +#: templates/ishtar/sheet_operation.html:45  msgid "Surface:"  msgstr "Surface :" -#: templates/ishtar/sheet_operation.html:40 +#: templates/ishtar/sheet_operation.html:46  msgid "Cost:"  msgstr "Coût :" -#: templates/ishtar/sheet_operation.html:41 +#: templates/ishtar/sheet_operation.html:47  msgid "Duration:"  msgstr "Durée :" -#: templates/ishtar/sheet_operation.html:41 +#: templates/ishtar/sheet_operation.html:47  msgid "Day"  msgstr "Jour" -#: templates/ishtar/sheet_operation.html:43 +#: templates/ishtar/sheet_operation.html:49  msgid "Remains:"  msgstr "Vestiges :" -#: templates/ishtar/sheet_operation.html:44 +#: templates/ishtar/sheet_operation.html:50  msgid "Periods:"  msgstr "Périodes :" -#: templates/ishtar/sheet_operation.html:47 +#: templates/ishtar/sheet_operation.html:53  msgid "Associated file:"  msgstr "Dossier archéologique associé :" -#: templates/ishtar/sheet_operation.html:50 +#: templates/ishtar/sheet_operation.html:56  msgid "Town planning service:"  msgstr "Service instructeur :" -#: templates/ishtar/sheet_operation.html:51 +#: templates/ishtar/sheet_operation.html:57  msgid "Permit type:"  msgstr "Type de permis :" -#: templates/ishtar/sheet_operation.html:52 +#: templates/ishtar/sheet_operation.html:58  msgid "Permit reference:"  msgstr "Référence du permis :" -#: templates/ishtar/sheet_operation.html:53 +#: templates/ishtar/sheet_operation.html:59  msgid "General contractor organisation:"  msgstr "Organisation de l'aménageur :" -#: templates/ishtar/sheet_operation.html:54 +#: templates/ishtar/sheet_operation.html:60  msgid "General contractor:"  msgstr "Aménageur :" -#: templates/ishtar/sheet_operation.html:58 +#: templates/ishtar/sheet_operation.html:64  msgid "Comment:"  msgstr "Commentaire :" -#: templates/ishtar/sheet_operation.html:60 +#: templates/ishtar/sheet_operation.html:66  msgid "Localisation"  msgstr "Localisation" -#: templates/ishtar/sheet_operation.html:61 +#: templates/ishtar/sheet_operation.html:67  msgid "Towns:"  msgstr "Communes :" -#: templates/ishtar/sheet_operation.html:63 +#: templates/ishtar/sheet_operation.html:69  msgid "Main address:"  msgstr "Adresse des terrains :" -#: templates/ishtar/sheet_operation.html:64 +#: templates/ishtar/sheet_operation.html:70  msgid "Complement:"  msgstr "Complément :" -#: templates/ishtar/sheet_operation.html:65 +#: templates/ishtar/sheet_operation.html:71  msgid "Postal code:"  msgstr "Code postal :" -#: templates/ishtar/sheet_operation.html:73 +#: templates/ishtar/sheet_operation.html:79  msgid "Associated parcels"  msgstr "Parcelles associées" -#: templates/ishtar/sheet_operation.html:75 +#: templates/ishtar/sheet_operation.html:81  msgid "Commune"  msgstr "Commune" -#: templates/ishtar/sheet_operation.html:90 +#: templates/ishtar/sheet_operation.html:96  msgid "No parcel associated to this operation"  msgstr "Pas de parcelle associée à cette opération" -#: templates/ishtar/sheet_operation.html:98 +#: templates/ishtar/sheet_operation.html:104  msgid "Ref."  msgstr "Réf." -#: templates/ishtar/sheet_operation.html:99 -#: templates/ishtar/sheet_operation.html:119 -#: templates/ishtar/sheet_operation.html:139 +#: templates/ishtar/sheet_operation.html:105 +#: templates/ishtar/sheet_operation.html:127  #: templates/ishtar/dashboards/dashboard_operation.html:82  msgid "Type"  msgstr "Type" -#: templates/ishtar/sheet_operation.html:100 +#: templates/ishtar/sheet_operation.html:106  msgid "Date"  msgstr "Date" -#: templates/ishtar/sheet_operation.html:110 +#: templates/ishtar/sheet_operation.html:116  msgid "No acts associated to this operation"  msgstr "Pas d'acte associé à cette opération" -#: templates/ishtar/sheet_operation.html:114 -msgid "Scientific documentation" -msgstr "Documentation scientifique" - -#: templates/ishtar/sheet_operation.html:116 -msgid "Documents" -msgstr "Documents" - -#: templates/ishtar/sheet_operation.html:118 -msgid "Title" -msgstr "Titre" -  #: templates/ishtar/sheet_operation.html:120 -msgid "Authors" -msgstr "Auteurs" - -#: templates/ishtar/sheet_operation.html:121 -#: templates/ishtar/sheet_operation.html:128 -msgid "Link" -msgstr "Lien" - -#: templates/ishtar/sheet_operation.html:131 -msgid "No scientific document associated to this operation" -msgstr "Pas de document scientifique associé à cette opération" +msgid "Document from this operation" +msgstr "Documents de cette opération" -#: templates/ishtar/sheet_operation.html:136 +#: templates/ishtar/sheet_operation.html:124  msgid "Context records"  msgstr "Unité d'Enregistrement" -#: templates/ishtar/sheet_operation.html:138 +#: templates/ishtar/sheet_operation.html:126  msgid "ID"  msgstr "Identifiant" -#: templates/ishtar/sheet_operation.html:140 +#: templates/ishtar/sheet_operation.html:128  msgid "Chronology"  msgstr "Chronologie" -#: templates/ishtar/sheet_operation.html:141 -#: templates/ishtar/sheet_operation.html:167 +#: templates/ishtar/sheet_operation.html:129 +#: templates/ishtar/sheet_operation.html:159  msgid "Description"  msgstr "Description" -#: templates/ishtar/sheet_operation.html:152 -#: templates/ishtar/sheet_operation.html:191 +#: templates/ishtar/sheet_operation.html:140 +#: templates/ishtar/sheet_operation.html:183  msgid "Details"  msgstr "Détails" -#: templates/ishtar/sheet_operation.html:155 +#: templates/ishtar/sheet_operation.html:143  msgid "No context record associated to this operation"  msgstr "Pas d'Unité d'Enregistrement associée à cette opération" -#: templates/ishtar/sheet_operation.html:160 +#: templates/ishtar/sheet_operation.html:147 +msgid "Documents from associated context records" +msgstr "Documents d'Unité d'Enregistrement associés" + +#: templates/ishtar/sheet_operation.html:152  msgid "Finds"  msgstr "Mobilier" -#: templates/ishtar/sheet_operation.html:162 +#: templates/ishtar/sheet_operation.html:154  msgid "Complete Id"  msgstr "Id complet" -#: templates/ishtar/sheet_operation.html:163 +#: templates/ishtar/sheet_operation.html:155  msgid "Short Id"  msgstr "Id court" -#: templates/ishtar/sheet_operation.html:164 +#: templates/ishtar/sheet_operation.html:156  msgid "Material type"  msgstr "Type de matériau" -#: templates/ishtar/sheet_operation.html:165 +#: templates/ishtar/sheet_operation.html:157  msgctxt "short"  msgid "Context record"  msgstr "UE" -#: templates/ishtar/sheet_operation.html:168 +#: templates/ishtar/sheet_operation.html:160  msgid "Weight"  msgstr "Poids" -#: templates/ishtar/sheet_operation.html:169 +#: templates/ishtar/sheet_operation.html:161  msgid "Numbers"  msgstr "Nombre" -#: templates/ishtar/sheet_operation.html:171 +#: templates/ishtar/sheet_operation.html:163  msgid "Container ref."  msgstr "Réf. du contenant" -#: templates/ishtar/sheet_operation.html:172 +#: templates/ishtar/sheet_operation.html:164  msgid "Warehouse"  msgstr "Dépôt" -#: templates/ishtar/sheet_operation.html:195 +#: templates/ishtar/sheet_operation.html:187  msgid "No find associated to context record"  msgstr "Pas de mobilier associé à cette Unité d'Enregistrement" -#: templates/ishtar/sheet_operation.html:198 +#: templates/ishtar/sheet_operation.html:190  msgid "No find associated to parcel"  msgstr "Pas de mobilier associé à cette parcelle" -#: templates/ishtar/sheet_operation.html:198 +#: templates/ishtar/sheet_operation.html:190  msgid "(no context record)"  msgstr "(pas d'Unité d'Enregistrement)" +#: templates/ishtar/sheet_operation.html:195 +msgid "Documents from associated finds" +msgstr "Documents concernant le mobilier associé" +  #: templates/ishtar/dashboards/dashboard_operation.html:11  msgid "Global informations"  msgstr "Informations générales" @@ -1097,6 +1107,24 @@ msgstr "Coût FNAP"  msgid "Main towns by cost"  msgstr "Principales communes par coût" +#~ msgid "Scientific documentation" +#~ msgstr "Documentation scientifique" + +#~ msgid "Documents" +#~ msgstr "Documents" + +#~ msgid "Title" +#~ msgstr "Titre" + +#~ msgid "Authors" +#~ msgstr "Auteurs" + +#~ msgid "Link" +#~ msgstr "Lien" + +#~ msgid "No scientific document associated to this operation" +#~ msgstr "Pas de document scientifique associé à cette opération" +  #~ msgid "Reference"  #~ msgstr "Référence" diff --git a/archaeological_operations/migrations/0012_auto.py b/archaeological_operations/migrations/0012_auto.py new file mode 100644 index 000000000..311f3f3d3 --- /dev/null +++ b/archaeological_operations/migrations/0012_auto.py @@ -0,0 +1,415 @@ +# -*- 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): +        # Adding M2M table for field associated_template on 'ActType' +        db.create_table('archaeological_operations_acttype_associated_template', ( +            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), +            ('acttype', models.ForeignKey(orm['archaeological_operations.acttype'], null=False)), +            ('documenttemplate', models.ForeignKey(orm['ishtar_common.documenttemplate'], null=False)) +        )) +        db.create_unique('archaeological_operations_acttype_associated_template', ['acttype_id', 'documenttemplate_id']) + + +    def backwards(self, orm): +        # Removing M2M table for field associated_template on 'ActType' +        db.delete_table('archaeological_operations_acttype_associated_template') + + +    models = { +        'archaeological_files.file': { +            'Meta': {'ordering': "['-year', '-numeric_reference']", 'object_name': 'File'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', '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': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}), +            'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_responsability'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'unique': 'True', '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'}), +            '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'}), +            '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'}), +            'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", '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'}), +            'town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), +            'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), +            'year': ('django.db.models.fields.IntegerField', [], {'default': '2013'}) +        }, +        'archaeological_files.filetype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'FileType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        'archaeological_files.permittype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PermitType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        'archaeological_files.saisinetype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'SaisineType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'delay': ('django.db.models.fields.IntegerField', [], {}), +            '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': '30'}) +        }, +        'archaeological_operations.acttype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'ActType'}, +            'associated_template': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.DocumentTemplate']", 'null': 'True', 'blank': 'True'}), +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'intented_to': ('django.db.models.fields.CharField', [], {'max_length': '1'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.administrativeact': { +            'Meta': {'object_name': 'AdministrativeAct'}, +            'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), +            'act_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.ActType']"}), +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), +            'operator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), +            'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), +            'scientific': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'signatory': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.historicaladministrativeact': { +            'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalAdministrativeAct'}, +            'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), +            'act_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'associated_file_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'}), +            'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operation_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), +            'scientific_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'signatory_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.historicaloperation': { +            'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOperation'}, +            'associated_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'cira_rapporteur_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), +            'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'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'}), +            'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.operation': { +            'Meta': {'object_name': 'Operation'}, +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operations'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'cira_rapporteur': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), +            'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operation_responsability'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'operation_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['archaeological_operations.OperationType']"}), +            'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'periods': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.Period']", 'symmetrical': 'False'}), +            'remains': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.RemainType']", 'symmetrical': 'False'}), +            'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'towns': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.Town']", 'symmetrical': 'False'}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.operationbydepartment': { +            'Meta': {'object_name': 'OperationByDepartment', 'db_table': "'operation_department'", 'managed': 'False'}, +            'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Operation']"}) +        }, +        'archaeological_operations.operationsource': { +            'Meta': {'object_name': 'OperationSource'}, +            'associated_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'authors': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'operationsource_related'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Author']"}), +            'creation_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'index': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_operations.Operation']"}), +            'receipt_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'reference': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}), +            'source_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.SourceType']"}), +            'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) +        }, +        'archaeological_operations.operationtype': { +            'Meta': {'ordering': "['label']", 'object_name': 'OperationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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'}), +            'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.parcel': { +            'Meta': {'object_name': 'Parcel'}, +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), +            'parcel_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}), +            'section': ('django.db.models.fields.CharField', [], {'max_length': '4'}), +            'town': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcels'", 'to': "orm['ishtar_common.Town']"}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.parcelowner': { +            'Meta': {'object_name': 'ParcelOwner'}, +            'end_date': ('django.db.models.fields.DateField', [], {}), +            'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"}), +            'parcel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Parcel']"}), +            'start_date': ('django.db.models.fields.DateField', [], {}) +        }, +        'archaeological_operations.period': { +            'Meta': {'ordering': "('order',)", 'object_name': 'Period'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.IntegerField', [], {}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'order': ('django.db.models.fields.IntegerField', [], {}), +            'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.IntegerField', [], {}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.remaintype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'RemainType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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.author': { +            'Meta': {'object_name': 'Author'}, +            'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'author'", 'to': "orm['ishtar_common.Person']"}) +        }, +        'ishtar_common.authortype': { +            'Meta': {'object_name': 'AuthorType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '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'}) +        }, +        'ishtar_common.documenttemplate': { +            'Meta': {'ordering': "['associated_object_name']", 'object_name': 'DocumentTemplate'}, +            'associated_object_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'template': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) +        }, +        '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'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            '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': '30', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.organizationtype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), +            'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}), +            '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'}), +            'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}), +            'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.persontype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False'}), +            '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': '30'}) +        }, +        'ishtar_common.sourcetype': { +            'Meta': {'object_name': 'SourceType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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_operations']
\ No newline at end of file diff --git a/archaeological_operations/migrations/0013_auto__add_field_acttype_code.py b/archaeological_operations/migrations/0013_auto__add_field_acttype_code.py new file mode 100644 index 000000000..273c8cd24 --- /dev/null +++ b/archaeological_operations/migrations/0013_auto__add_field_acttype_code.py @@ -0,0 +1,413 @@ +# -*- 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): +        # Adding field 'ActType.code' +        db.add_column('archaeological_operations_acttype', 'code', +                      self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True), +                      keep_default=False) + + +    def backwards(self, orm): +        # Deleting field 'ActType.code' +        db.delete_column('archaeological_operations_acttype', 'code') + + +    models = { +        'archaeological_files.file': { +            'Meta': {'ordering': "['-year', '-numeric_reference']", 'object_name': 'File'}, +            'address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'address_complement': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', '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': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.FileType']"}), +            'general_contractor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'file_responsability'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '60', 'unique': 'True', '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'}), +            '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'}), +            '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'}), +            'saisine_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_files.SaisineType']", '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'}), +            'town_planning_service': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Organization']"}), +            'towns': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'file'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Town']"}), +            'year': ('django.db.models.fields.IntegerField', [], {'default': '2013'}) +        }, +        'archaeological_files.filetype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'FileType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        'archaeological_files.permittype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PermitType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        'archaeological_files.saisinetype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'SaisineType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'delay': ('django.db.models.fields.IntegerField', [], {}), +            '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': '30'}) +        }, +        'archaeological_operations.acttype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'ActType'}, +            'associated_template': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['ishtar_common.DocumentTemplate']", 'null': 'True', 'blank': 'True'}), +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'code': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'intented_to': ('django.db.models.fields.CharField', [], {'max_length': '1'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.administrativeact': { +            'Meta': {'object_name': 'AdministrativeAct'}, +            'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), +            'act_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.ActType']"}), +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'administrative_act'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), +            'operator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), +            'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), +            'scientific': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'signatory': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.historicaladministrativeact': { +            'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalAdministrativeAct'}, +            'act_object': ('django.db.models.fields.CharField', [], {'max_length': '200'}), +            'act_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'associated_file_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'}), +            'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operation_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operator_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'ref_sra': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), +            'scientific_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'signatory_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'signature_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.historicaloperation': { +            'Meta': {'ordering': "('-history_date', '-history_id')", 'object_name': 'HistoricalOperation'}, +            'associated_file_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'cira_rapporteur_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), +            'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'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'}), +            'in_charge_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'operation_type_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), +            'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.operation': { +            'Meta': {'object_name': 'Operation'}, +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operations'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'cached_label': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}), +            'cira_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'cira_rapporteur': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'+'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'code_dracar': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}), +            'code_patriarche': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'common_name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), +            'cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'eas_number': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'effective_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'excavation_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_cost': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'fnap_financing': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), +            'geoarchaeological_context_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'in_charge': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'operation_responsability'", 'null': 'True', 'to': "orm['ishtar_common.Person']"}), +            'large_area_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'negative_result': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), +            'operation_code': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'operation_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['archaeological_operations.OperationType']"}), +            'operator_reference': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'optional_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'periods': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.Period']", 'symmetrical': 'False'}), +            'remains': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['archaeological_operations.RemainType']", 'symmetrical': 'False'}), +            'report_delivery_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'scheduled_man_days': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'surface': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'towns': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ishtar_common.Town']", 'symmetrical': 'False'}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'zoning_prescription': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.operationbydepartment': { +            'Meta': {'object_name': 'OperationByDepartment', 'db_table': "'operation_department'", 'managed': 'False'}, +            'department': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Department']", 'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Operation']"}) +        }, +        'archaeological_operations.operationsource': { +            'Meta': {'object_name': 'OperationSource'}, +            'associated_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), +            'authors': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'operationsource_related'", 'symmetrical': 'False', 'to': "orm['ishtar_common.Author']"}), +            'creation_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'index': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), +            'internal_reference': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'source'", 'to': "orm['archaeological_operations.Operation']"}), +            'receipt_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), +            'reference': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}), +            'source_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.SourceType']"}), +            'title': ('django.db.models.fields.CharField', [], {'max_length': '300'}) +        }, +        'archaeological_operations.operationtype': { +            'Meta': {'ordering': "['label']", 'object_name': 'OperationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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'}), +            'preventive': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.parcel': { +            'Meta': {'object_name': 'Parcel'}, +            'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_files.File']"}), +            'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'operation': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'parcels'", 'null': 'True', 'to': "orm['archaeological_operations.Operation']"}), +            'parcel_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}), +            'section': ('django.db.models.fields.CharField', [], {'max_length': '4'}), +            'town': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parcels'", 'to': "orm['ishtar_common.Town']"}), +            'year': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) +        }, +        'archaeological_operations.parcelowner': { +            'Meta': {'object_name': 'ParcelOwner'}, +            'end_date': ('django.db.models.fields.DateField', [], {}), +            'history_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.Person']"}), +            'parcel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Parcel']"}), +            'start_date': ('django.db.models.fields.DateField', [], {}) +        }, +        'archaeological_operations.period': { +            'Meta': {'ordering': "('order',)", 'object_name': 'Period'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'end_date': ('django.db.models.fields.IntegerField', [], {}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'order': ('django.db.models.fields.IntegerField', [], {}), +            'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archaeological_operations.Period']", 'null': 'True', 'blank': 'True'}), +            'start_date': ('django.db.models.fields.IntegerField', [], {}), +            'txt_idx': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) +        }, +        'archaeological_operations.remaintype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'RemainType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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.author': { +            'Meta': {'object_name': 'Author'}, +            'author_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ishtar_common.AuthorType']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'author'", 'to': "orm['ishtar_common.Person']"}) +        }, +        'ishtar_common.authortype': { +            'Meta': {'object_name': 'AuthorType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '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'}) +        }, +        'ishtar_common.documenttemplate': { +            'Meta': {'ordering': "['associated_object_name']", 'object_name': 'DocumentTemplate'}, +            'associated_object_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            'template': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}) +        }, +        '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'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), +            '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': '30', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.organizationtype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'OrganizationType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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', [], {'to': "orm['ishtar_common.Organization']", 'null': 'True', 'blank': 'True'}), +            'country': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}), +            'email': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), +            'history_modifier': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['auth.User']"}), +            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), +            'mobile_phone': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}), +            'name': ('django.db.models.fields.CharField', [], {'max_length': '30'}), +            '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'}), +            'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), +            'title': ('django.db.models.fields.CharField', [], {'max_length': '2'}), +            'town': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}) +        }, +        'ishtar_common.persontype': { +            'Meta': {'ordering': "('label',)", 'object_name': 'PersonType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            'comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), +            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False'}), +            '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': '30'}) +        }, +        'ishtar_common.sourcetype': { +            'Meta': {'object_name': 'SourceType'}, +            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), +            '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': '30'}) +        }, +        '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_operations']
\ No newline at end of file diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index e4e56843f..125a5d7d1 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -31,7 +31,8 @@ from ishtar_common.utils import cached_label_changed  from ishtar_common.models import GeneralType, BaseHistorizedItem, \       HistoricalRecords, LightHistorizedItem, OwnPerms, Department, Source,\ -     Person, Organization, Town, Dashboard, IshtarUser, ValueGetter +     Person, Organization, Town, Dashboard, IshtarUser, ValueGetter, \ +     DocumentTemplate  FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS  if FILES_AVAILABLE:      from archaeological_files.models import File @@ -352,6 +353,9 @@ class ActType(GeneralType):              )      intented_to = models.CharField(_(u"Intended to"), max_length=1,                                     choices=TYPE) +    code = models.CharField(_(u"Code"), max_length=10, blank=True, null=True) +    associated_template = models.ManyToManyField(DocumentTemplate, blank=True, +                            null=True, verbose_name=_(u"Associated template"))      class Meta:          verbose_name = _(u"Act type")          verbose_name_plural = _(u"Act types") @@ -408,6 +412,26 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):            for item in [self.operation, self.associated_file, self.act_object]            if item]) +    def get_filename(self, operation=False): +        filename = '' +        if operation and self.operation: +            filename = self.operation.associated_filename +        elif self.associated_file: +            filename = self.associated_file.associated_filename +        filename = u"-".join(filename.split('-')[:-1]) # remove date +        if self.act_type.code: +            filename += u"-" + self.act_type.code +        if self.signature_date: +            filename += u"-" + self.signature_date.strftime('%Y%m%d') +        return filename + +    def publish(self): +        if not self.act_type.associated_template.count(): +            return +        # for administrative_act only one associated_template +        template = self.act_type.associated_template.all()[0] +        return template.publish(self) +  class Parcel(LightHistorizedItem):      if FILES_AVAILABLE:          associated_file = models.ForeignKey(File, related_name='parcels', diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index 13a2c5c35..4453b10ed 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -71,6 +71,9 @@ urlpatterns += patterns('archaeological_operations.views',             'show_operation', name='show-historized-operation'),       url(r'get-administrativeactop/(?P<type>.+)?$',             'get_administrativeactop', name='get-administrativeactop'), +     url(r'generatedoc-administrativeactop/(?P<pk>.+)?$', +           'generatedoc_administrativeactop', +           name='generatedoc-administrativeactop'),       url(r'get-operationsource/(?P<type>.+)?$',             'get_operationsource', name='get-operationsource'),       url(r'dashboard_operation/$', 'dashboard_operation', diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 97446b635..c899b1c4d 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -18,10 +18,12 @@  # See the file COPYING for details.  import json +import os  from django.db.models import Q  from django.http import HttpResponse  from django.shortcuts import render_to_response +from django.template.defaultfilters import slugify  from django.utils.translation import ugettext_lazy as _  from ishtar_common.views import get_item, show_item, revert_item @@ -258,3 +260,27 @@ operation_administrativeactop_deletion_wizard = \      label=_(u"Operation: administrative act deletion"),      url_name='operation_administrativeactop_deletion',) +def generatedoc_administrativeactop(request, pk): +    if (not request.user.has_perm('ishtar_common.view_operation', +                                  models.Operation) +        and not request.user.has_perm('ishtar_common.view_own_operation', +                                      models.Operation)): +        return HttpResponse(mimetype='text/plain') +    try: +        act_file = models.AdministrativeAct.objects.get(pk=pk) +        doc = act_file.publish() +    except models.AdministrativeAct.DoesNotExist: +        doc = None +    if doc: +        MIMES = {'odt':'application/vnd.oasis.opendocument.text', +                 'ods':'application/vnd.oasis.opendocument.spreadsheet'} +        ext = doc.split('.')[-1] +        doc_name = act_file.get_filename() + "." + ext +        mimetype = 'text/csv' +        if ext in MIMES: +            mimetype = MIMES[ext] +        response = HttpResponse(open(doc), mimetype=mimetype) +        response['Content-Disposition'] = 'attachment; filename=%s' % \ +                                                                doc_name +        return response +    return HttpResponse(mimetype='text/plain') diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index 07c8844b9..86af26351 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -19,6 +19,7 @@  from django.conf import settings  from django.core.exceptions import ObjectDoesNotExist +from django.core.urlresolvers import reverse  from django.db.models import Max  from django.shortcuts import render_to_response  from django.template import RequestContext @@ -27,7 +28,7 @@ from django.utils.translation import ugettext_lazy as _  from ishtar_common.wizards import Wizard, ClosingWizard, DeletionWizard, \                                    SourceWizard  import models -from forms import ParcelForm +from forms import ParcelForm, GenerateDocForm  class OperationWizard(Wizard):      model = models.Operation @@ -267,18 +268,27 @@ class OperationAdministrativeActWizard(OperationWizard):          dct['history_modifier'] = self.request.user          return dct +    def get_context_data(self, form, **kwargs): +        # manage document generation +        context = super(OperationAdministrativeActWizard, self +                                      ).get_context_data(form, **kwargs) +        step = self.steps.current +        if step.startswith('final-'): +            general_form_key = 'administrativeact-' + self.url_name +            try: +                act_type = models.ActType.objects.get( +                    pk=self.session_get_value(general_form_key, "act_type")) +            except models.ActType.DoesNotExist: +                pass +            if act_type and act_type.associated_template.count(): +                context['extra_form'] = GenerateDocForm() +        return context +      def get_associated_item(self, dct):          return self.get_current_object()      def save_model(self, dct, m2m, whole_associated_models, form_list,                     return_object): -        associated_item = self.get_associated_item(dct) -        if not associated_item: -            return self.render(form_list[-1]) -        if isinstance(associated_item, models.File): -            dct['associated_file'] = associated_item -        elif isinstance(associated_item, models.Operation): -            dct['operation'] = associated_item          dct['history_modifier'] = self.request.user          if 'pk' in dct:              dct.pop('pk') @@ -288,10 +298,35 @@ class OperationAdministrativeActWizard(OperationWizard):                  if hasattr(admact, k):                      setattr(admact, k, dct[k])          else: +            associated_item = self.get_associated_item(dct) +            if not associated_item: +                return self.render(form_list[-1]) +            if isinstance(associated_item, models.File): +                dct['associated_file'] = associated_item +            elif isinstance(associated_item, models.Operation): +                dct['operation'] = associated_item              admact = models.AdministrativeAct(**dct)          admact.save() -        res = render_to_response('ishtar/wizard/wizard_done.html', {}, -                                  context_instance=RequestContext(self.request)) +        dct['item'] = admact + +        # check if a doc generation is required +        keys = [self.storage.prefix, 'step_data', 'final-' + self.url_name, +                'doc_generation'] +        level = 0 +        r = self.request.session +        for k in keys: +            if k in r and r[k]: +                level += 1 +                r = r[k] +            else: +                break +        if level == len(keys): # the whole tree as been traversed +            # redirect to the generated doc +            dct['redirect'] = reverse('generatedoc-administrativeactop', +                                      args=[admact.pk]) + +        res = render_to_response('ishtar/wizard/wizard_done.html', dct, +                                 context_instance=RequestContext(self.request))          return res  class OperationEditAdministrativeActWizard(OperationAdministrativeActWizard): diff --git a/example_project/settings.py b/example_project/settings.py index 1e9051429..753c21a07 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -45,6 +45,8 @@ LANGUAGE_CODE = 'fr-fr'  COUNTRY = "fr" +DATE_FORMAT = u"%-d %B %Y" +  SITE_ID = 1  # If you set this to False, Django will make some optimizations so as not diff --git a/ishtar_common/fixtures/groups_person_types-SRA-fr.json b/ishtar_common/fixtures/groups_person_types-SRA-fr.json index e758bd645..9a43072b2 100644 --- a/ishtar_common/fixtures/groups_person_types-SRA-fr.json +++ b/ishtar_common/fixtures/groups_person_types-SRA-fr.json @@ -252,6 +252,37 @@          }      },      { +        "pk": 25, +        "model": "auth.group", +        "fields": { +            "name": "Organisations : voir", +            "permissions": [ +                246 +            ] +        } +    }, +    { +        "pk": 26, +        "model": "auth.group", +        "fields": { +            "name": "Organisations : modification/suppression", +            "permissions": [ +                44, +                45 +            ] +        } +    }, +    { +        "pk": 27, +        "model": "auth.group", +        "fields": { +            "name": "Organisations : ajout", +            "permissions": [ +                43 +            ] +        } +    }, +    {          "pk": 7,          "model": "ishtar_common.persontype",          "fields": { @@ -281,23 +312,23 @@              "available": true,              "txt_idx": "sra_agent",              "groups": [ -                1, -                2, -                4, -                5, -                6, -                7, -                8, -                9,                  10,                  13, -                14,                  15, -                16, +                14,                  17, +                16,                  18, -                21, -                22 +                22, +                1, +                2, +                5, +                4, +                7, +                6, +                9, +                8, +                21              ],              "label": "Agent SRA (prescripteur)"          } @@ -343,17 +374,23 @@              "available": true,              "txt_idx": "secretarial_dept",              "groups": [ -                1,                  2, -                6, +                1, +                3,                  7, +                6,                  8,                  9,                  10,                  13,                  14,                  17, -                18 +                18, +                23, +                24, +                25, +                26, +                27              ],              "label": "Secr\u00e9tariat SRA"          } diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index e82a6e86d..5faa232fb 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -145,3 +145,29 @@ def get_form_selection(class_name, label, key, model, base_form, get_url,          return cleaned_data      attrs['clean'] = clean      return type(class_name, (forms.Form,), attrs) + +class DocumentGenerationForm(forms.Form): +    """ +    Form to generate document by choosing the template +    """ +    _associated_model = None # ex: AdministrativeAct +    _associated_object_name = '' # ex: 'archaeological_operations.models.AdministrativeAct' +    document_template = forms.ChoiceField(label=_("Template"), choices=[]) + +    def __init__(self, *args, **kwargs): +        super(DocumentGenerationForm, self).__init__(*args, **kwargs) +        self.fields['document_template'].choices = \ +                models.DocumentTemplate.get_tuples( +                    dct={'associated_object_name':self._associated_object_name}) + +    def save(self, object_pk): +        try: +            c_object = self._associated_model.objects.get(pk=object_pk) +        except self._associated_model.DoesNotExist: +            return +        try: +            template = models.DocumentTemplate.objects.get( +                            pk=self.cleaned_data.get('document_template')) +        except models.DocumentTemplate.DoesNotExist: +            return +        return template.publish(c_object) diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 661709a09..b6cab8b6a 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -124,7 +124,7 @@ class PersonFormSelection(forms.Form):                                       PersonSelect, models.Person),           validators=[models.valid_id(models.Person)]) -class PersonForm(forms.Form): +class SimplePersonForm(forms.Form):      form_label = _("Identity")      associated_models = {'attached_to':models.Organization}      title = forms.ChoiceField(label=_("Title"), choices=models.Person.TYPE) @@ -132,6 +132,15 @@ class PersonForm(forms.Form):                                validators=[name_validator])      name = forms.CharField(label=_(u"Name"), max_length=30,                                validators=[name_validator]) +    address = forms.CharField(label=_(u"Address"), widget=forms.Textarea, +                              required=False) +    address_complement = forms.CharField(label=_(u"Address complement"), +                                         widget=forms.Textarea, required=False) +    postal_code = forms.CharField(label=_(u"Postal code"), max_length=10, +                                  required=False) +    town = forms.CharField(label=_(u"Town"), max_length=30, required=False) +    country = forms.CharField(label=_(u"Country"), max_length=30, +                              required=False)      email = forms.CharField(label=_(u"Email"), max_length=40, required=False,                              validators=[validators.validate_email])      attached_to = forms.IntegerField(label=_("Current organization"), @@ -139,6 +148,8 @@ class PersonForm(forms.Form):                      reverse_lazy('autocomplete-organization'),                      associated_model=models.Organization, new=True),          validators=[models.valid_id(models.Organization)], required=False) + +class PersonForm(SimplePersonForm):      person_types = forms.MultipleChoiceField(label=_("Person type"),                               choices=[], widget=forms.CheckboxSelectMultiple) diff --git a/ishtar_common/locale/fr/LC_MESSAGES/django.po b/ishtar_common/locale/fr/LC_MESSAGES/django.po index f6da52ee3..cb8cd135c 100644 --- a/ishtar_common/locale/fr/LC_MESSAGES/django.po +++ b/ishtar_common/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid ""  msgstr ""  "Project-Id-Version: alpha\n"  "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-10-28 21:37+0100\n" +"POT-Creation-Date: 2013-12-02 20:33+0100\n"  "PO-Revision-Date: 2010-12-09\n"  "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n"  "Language-Team: \n" @@ -68,8 +68,8 @@ msgstr "Vous devez sélectionner un élément."  msgid "Add a new item"  msgstr "Ajouter un nouvel élément" -#: forms_common.py:42 forms_common.py:80 forms_common.py:84 models.py:613 -#: models.py:836 templates/ishtar/sheet_person.html:19 +#: forms_common.py:42 forms_common.py:80 forms_common.py:84 models.py:667 +#: models.py:896 templates/ishtar/sheet_person.html:19  #: templates/ishtar/sheet_person.html:29  msgid "Town"  msgstr "Commune" @@ -92,63 +92,63 @@ msgstr ""  "<p class='example'>Par exemple tapez « saint denis 93 » pour obtenir la "  "commune Saint-Denis dans le département français de Seine-Saint-Denis.</p>" -#: forms_common.py:56 forms_common.py:296 ishtar_menu.py:29 models.py:675 -#: models.py:727 models.py:761 templates/ishtar/sheet_person.html:6 +#: forms_common.py:56 forms_common.py:296 ishtar_menu.py:29 models.py:730 +#: models.py:787 models.py:821 templates/ishtar/sheet_person.html:6  msgid "Person"  msgstr "Individu" -#: forms_common.py:70 forms_common.py:104 forms_common.py:133 models.py:631 -#: models.py:668 models.py:822 templates/ishtar/sheet_person.html:12 -#: templates/ishtar/sheet_person.html:25 +#: forms_common.py:70 forms_common.py:104 forms_common.py:133 models.py:617 +#: models.py:685 models.py:723 models.py:882 +#: templates/ishtar/sheet_person.html:12 templates/ishtar/sheet_person.html:25  msgid "Name"  msgstr "Nom" -#: forms_common.py:72 models.py:626 +#: forms_common.py:72 models.py:680  msgid "Organization type"  msgstr "Type d'organisation" -#: forms_common.py:74 models.py:608 templates/ishtar/sheet_person.html:16 +#: forms_common.py:74 models.py:662 templates/ishtar/sheet_person.html:16  #: templates/ishtar/sheet_person.html:26  msgid "Address"  msgstr "Adresse" -#: forms_common.py:76 models.py:609 templates/ishtar/sheet_person.html:17 +#: forms_common.py:76 models.py:663 templates/ishtar/sheet_person.html:17  #: templates/ishtar/sheet_person.html:27  msgid "Address complement"  msgstr "Complément d'adresse" -#: forms_common.py:78 models.py:611 templates/ishtar/sheet_person.html:18 +#: forms_common.py:78 models.py:665 templates/ishtar/sheet_person.html:18  #: templates/ishtar/sheet_person.html:28  msgid "Postal code"  msgstr "Code postal" -#: forms_common.py:81 models.py:614 +#: forms_common.py:81 models.py:668  msgid "Country"  msgstr "Pays" -#: forms_common.py:83 models.py:616 templates/ishtar/sheet_person.html:20 +#: forms_common.py:83 models.py:670 templates/ishtar/sheet_person.html:20  #: templates/ishtar/sheet_person.html:30  msgid "Phone"  msgstr "Téléphone" -#: forms_common.py:105 forms_common.py:131 models.py:666 +#: forms_common.py:105 forms_common.py:131 models.py:721  #: templates/ishtar/sheet_person.html:13  msgid "Surname"  msgstr "Prénom" -#: forms_common.py:106 forms_common.py:135 forms_common.py:182 models.py:669 +#: forms_common.py:106 forms_common.py:135 forms_common.py:182 models.py:724  #: templates/ishtar/sheet_person.html:14  msgid "Email"  msgstr "Courriel" -#: forms_common.py:107 models.py:633 models.py:785 templates/sheet_ope.html:85 +#: forms_common.py:107 models.py:687 models.py:845 templates/sheet_ope.html:85  #: templates/sheet_ope.html.py:105 templates/sheet_ope.html:126  #: templates/ishtar/sheet_person.html:41 templates/ishtar/sheet_person.html:94  #: templates/ishtar/blocks/window_tables/documents.html:6  msgid "Type"  msgstr "Type" -#: forms_common.py:108 models.py:636 +#: forms_common.py:108 models.py:690  msgid "Organization"  msgstr "Organisation" @@ -160,7 +160,7 @@ msgstr "Recherche d'individus"  msgid "Identity"  msgstr "Identité" -#: forms_common.py:130 forms_common.py:253 models.py:665 models.py:784 +#: forms_common.py:130 forms_common.py:253 models.py:720 models.py:844  #: templates/sheet_ope.html:104 templates/ishtar/sheet_person.html:93  #: templates/ishtar/blocks/window_tables/documents.html:5  msgid "Title" @@ -170,7 +170,7 @@ msgstr "Titre"  msgid "Current organization"  msgstr "Organisation actuelle" -#: forms_common.py:142 forms_common.py:164 forms_common.py:167 models.py:653 +#: forms_common.py:142 forms_common.py:164 forms_common.py:167 models.py:707  msgid "Person type"  msgstr "Type d'individu" @@ -202,7 +202,7 @@ msgstr "Ce nom d'utilisateur existe déjà."  msgid "Send the new password by email?"  msgstr "Envoyer le nouveau mot de passe par courriel ?" -#: forms_common.py:233 forms_common.py:245 models.py:837 +#: forms_common.py:233 forms_common.py:245 models.py:897  #: templates/ishtar/sheet_person.html:71  msgid "Towns"  msgstr "Communes" @@ -215,23 +215,23 @@ msgstr "Il y a des communes identiques."  msgid "Documentation informations"  msgstr "Information sur le document" -#: forms_common.py:255 forms_common.py:274 models.py:780 +#: forms_common.py:255 forms_common.py:274 models.py:840  msgid "Source type"  msgstr "Type de source" -#: forms_common.py:257 models.py:789 +#: forms_common.py:257 models.py:849  msgid "Numerical ressource (web address)"  msgstr "Ressource numérique (adresse web)" -#: forms_common.py:258 models.py:791 +#: forms_common.py:258 models.py:851  msgid "Receipt date"  msgstr "Date de réception" -#: forms_common.py:260 models.py:793 +#: forms_common.py:260 models.py:853  msgid "Creation date"  msgstr "Date de création" -#: forms_common.py:271 forms_common.py:290 forms_common.py:320 models.py:766 +#: forms_common.py:271 forms_common.py:290 forms_common.py:320 models.py:826  msgid "Author"  msgstr "Auteur" @@ -239,7 +239,7 @@ msgstr "Auteur"  msgid "Would you like to delete this documentation?"  msgstr "Voulez vous supprimer ce document ?" -#: forms_common.py:297 models.py:757 models.py:763 +#: forms_common.py:297 models.py:817 models.py:823  msgid "Author type"  msgstr "Type d'auteur" @@ -251,7 +251,7 @@ msgstr "Sélection d'auteur"  msgid "There are identical authors."  msgstr "Il y a des auteurs identiques." -#: forms_common.py:330 models.py:767 models.py:786 +#: forms_common.py:330 models.py:827 models.py:846  #: templates/sheet_ope.html:106  #: templates/ishtar/blocks/window_tables/documents.html:7  msgid "Authors" @@ -273,192 +273,212 @@ msgstr "Modification"  msgid "Account management"  msgstr "Gestion des comptes" -#: models.py:96 +#: models.py:115  msgid "Not a valid item."  msgstr "Élément invalide." -#: models.py:108 +#: models.py:127  msgid "An item selected is not a valid item."  msgstr "Un élément sélectionné n'est pas valide." -#: models.py:118 +#: models.py:137  msgid "This item already exist."  msgstr "Cet élément existe déjà." -#: models.py:170 models.py:487 models.py:596 +#: models.py:189 models.py:506 models.py:650  msgid "Label"  msgstr "Libellé" -#: models.py:171 +#: models.py:190  msgid "Textual ID"  msgstr "Identifiant textuel" -#: models.py:173 +#: models.py:192  msgid "Comment"  msgstr "Commentaire" -#: models.py:174 +#: models.py:193 models.py:621  msgid "Available"  msgstr "Disponible" -#: models.py:340 +#: models.py:359  msgid "Last editor"  msgstr "Dernier éditeur" -#: models.py:475 models.py:486 +#: models.py:494 models.py:505  msgid "URL name"  msgstr "Nom de l'URL" -#: models.py:477 models.py:485 +#: models.py:496 models.py:504  msgid "Wizard"  msgstr "Assistant" -#: models.py:484 +#: models.py:503  msgid "Order"  msgstr "Ordre" -#: models.py:489 +#: models.py:508  msgid "Wizard step"  msgstr "Étape de l'assistant" -#: models.py:532 templates/sheet_ope.html:61 templates/sheet_ope.html.py:83 +#: models.py:551 templates/sheet_ope.html:61 templates/sheet_ope.html.py:83  #: templates/ishtar/sheet_person.html:38 templates/ishtar/sheet_person.html:67  #: templates/ishtar/sheet_person.html:92  msgid "Year"  msgstr "Année" -#: models.py:535 models.py:597 +#: models.py:554 models.py:651  #: templates/ishtar/dashboards/dashboard_main.html:74  msgid "Number"  msgstr "Nombre" -#: models.py:600 +#: models.py:616 +msgid "Administrative Act" +msgstr "Acte administratif" + +#: models.py:618 +msgid "Template" +msgstr "Patron" + +#: models.py:619 +msgid "Associated object" +msgstr "Objet associé" + +#: models.py:624 +msgid "Document template" +msgstr "Patron de document" + +#: models.py:625 +msgid "Document templates" +msgstr "Patrons de documents" + +#: models.py:654  msgid "Department"  msgstr "Département" -#: models.py:601 +#: models.py:655  msgid "Departments"  msgstr "Départements" -#: models.py:617 templates/ishtar/sheet_person.html:21 +#: models.py:671 templates/ishtar/sheet_person.html:21  #: templates/ishtar/sheet_person.html:31  msgid "Mobile phone"  msgstr "Téléphone portable" -#: models.py:627 +#: models.py:681  msgid "Organization types"  msgstr "Types d'organisation" -#: models.py:637 +#: models.py:691  msgid "Organizations"  msgstr "Organisations" -#: models.py:639 +#: models.py:693  msgid "Can view all Organization"  msgstr "Peut voir toutes les Organisations" -#: models.py:640 +#: models.py:694  msgid "Can view own Organization"  msgstr "Peut voir sa propre Organisation" -#: models.py:641 +#: models.py:695  msgid "Can add own Organization"  msgstr "Peut ajouter sa propre Organisation" -#: models.py:642 +#: models.py:696  msgid "Can change own Organization"  msgstr "Peut changer sa propre Organisation" -#: models.py:643 +#: models.py:697  msgid "Can delete own Organization"  msgstr "Peut supprimer sa propre Organisation" -#: models.py:651 +#: models.py:705  msgid "Groups"  msgstr "Groupes" -#: models.py:654 +#: models.py:708  msgid "Person types"  msgstr "Types d'individu" -#: models.py:658 +#: models.py:713  msgid "Mr" -msgstr "M" +msgstr "M." -#: models.py:659 +#: models.py:714  msgid "Miss"  msgstr "Mlle" -#: models.py:660 +#: models.py:715  msgid "Mrs"  msgstr "Mme" -#: models.py:661 +#: models.py:716  msgid "Doctor" -msgstr "Dr" +msgstr "Dr." -#: models.py:670 models.py:691 +#: models.py:725 models.py:751  msgid "Types"  msgstr "Types" -#: models.py:672 +#: models.py:727  msgid "Is attached to"  msgstr "Est rattaché à" -#: models.py:676 +#: models.py:731  msgid "Persons"  msgstr "Individus" -#: models.py:678 +#: models.py:733  msgid "Can view all Person"  msgstr "Peut voir toutes les Personnes" -#: models.py:679 +#: models.py:734  msgid "Can view own Person"  msgstr "Peut voir sa propre Personne" -#: models.py:680 +#: models.py:735  msgid "Can add own Person"  msgstr "Peut ajouter sa propre Personne" -#: models.py:681 +#: models.py:736  msgid "Can change own Person"  msgstr "Peut changer sa propre Personne" -#: models.py:682 +#: models.py:737  msgid "Can delete own Person"  msgstr "Peut supprimer sa propre Personne" -#: models.py:731 +#: models.py:791  msgid "Ishtar user"  msgstr "Utilisateur d'Ishtar" -#: models.py:732 +#: models.py:792  msgid "Ishtar users"  msgstr "Utilisateurs d'Ishtar" -#: models.py:758 +#: models.py:818  msgid "Author types"  msgstr "Types d'auteur" -#: models.py:781 +#: models.py:841  msgid "Source types"  msgstr "Types de source" -#: models.py:794 templates/ishtar/sheet_person.html:39 +#: models.py:854 templates/ishtar/sheet_person.html:39  #: templates/ishtar/sheet_person.html:66  msgid "Ref."  msgstr "Réf." -#: models.py:796 +#: models.py:856  msgid "Internal reference"  msgstr "Référence interne" -#: models.py:823 +#: models.py:883  msgid "Surface (m²)"  msgstr "Area (m²)" -#: models.py:824 templates/sheet_ope.html:46 templates/sheet_ope.html.py:107 +#: models.py:884 templates/sheet_ope.html:46 templates/sheet_ope.html.py:107  msgid "Localisation"  msgstr "Localisation" @@ -496,19 +516,19 @@ msgstr "Opération non permise"  msgid "New %s"  msgstr "Nouveau %s" -#: views.py:624 +#: views.py:621  msgid "Archaeological files"  msgstr "Dossiers archéologiques" -#: views.py:627 +#: views.py:624  msgid "Operations"  msgstr "Opérations" -#: views.py:630 +#: views.py:627  msgid "Context records"  msgstr "Unité d'Enregistrement" -#: views.py:633 +#: views.py:630  msgid "Finds"  msgstr "Mobilier" diff --git a/ishtar_common/models.py b/ishtar_common/models.py index aacc9f2d0..76ffb761f 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -76,6 +76,15 @@ class ValueGetter(object):                  values[prefix + field_name] = value          return values +    @classmethod +    def get_empty_values(cls, prefix=''): +        if not prefix: +            prefix = self._prefix +        values = {} +        for field_name in cls._meta.get_all_field_names(): +            values[prefix + field_name] = '' +        return values +  class HistoricalRecords(BaseHistoricalRecords):      def create_historical_record(self, instance, type):          history_modifier = getattr(instance, 'history_modifier', None) @@ -650,7 +659,7 @@ class DocumentTemplate(models.Model):      def publish(self, c_object):          tempdir = tempfile.mkdtemp("-ishtardocs")          output_name = tempdir + os.path.sep + \ -            self.name.replace(' ', '_').lower() + u'-' +\ +            slugify(self.name.replace(' ', '_').lower()) + u'-' +\              datetime.date.today().strftime('%Y-%m-%d') +\              u"." + self.template.name.split('.')[-1]          missing = ooo_replace(self.template, output_name, c_object.get_values()) @@ -691,7 +700,7 @@ class OrganizationType(GeneralType):          verbose_name_plural = _(u"Organization types")          ordering = ('label',) -class Organization(Address, OwnPerms): +class Organization(Address, OwnPerms, ValueGetter):      name = models.CharField(_(u"Name"), max_length=100)      organization_type = models.ForeignKey(OrganizationType,                                            verbose_name=_(u"Type")) @@ -753,6 +762,13 @@ class Person(Address, OwnPerms, ValueGetter) :                                 if getattr(self, attr)]          return u" ".join(values) +    def get_values(self, prefix=''): +        values = super(Person, self).get_values(prefix=prefix) +        values[prefix+'title'] = dict(self.TYPE)[self.title] +        if not self.attached_to: +            values.update(Person.get_empty_values(prefix=prefix + 'attached_to_')) +        return values +      person_types_list_lbl = _(u"Types")      @property      def person_types_list(self): diff --git a/ishtar_common/ooo_replace.py b/ishtar_common/ooo_replace.py index 63b983b7b..d929d9359 100644 --- a/ishtar_common/ooo_replace.py +++ b/ishtar_common/ooo_replace.py @@ -17,26 +17,28 @@  # See the file COPYING for details. - +import locale  from zipfile import ZipFile, ZIP_DEFLATED  from cStringIO import StringIO  from xml.etree.cElementTree import ElementTree, fromstring +from django.conf import settings +  OOO_NS = "{urn:oasis:names:tc:opendocument:xmlns:text:1.0}" -def _set_value_from_formula(value, context): +def _set_value_from_formula(value, context, default_value):      value = value.strip()      if value.startswith("ooow:") and len(value) >= 5:          value = value[5:]      if value.startswith('"') and value.endswith('"') and len(value) > 1:          value = value[1:-1]      elif value in context: -        value = unicode(context[value]) +        value = _format_value(context[value], default_value)      else:          value = None      return value -def _parse_condition(condition, context): +def _parse_condition(condition, context, default_value):      # parse only == and != operator      operator = ""      if "!=" in condition: @@ -46,17 +48,28 @@ def _parse_condition(condition, context):      else:          return      var1, var2 = condition.split(operator) -    var1 = _set_value_from_formula(var1, context) -    var2 = _set_value_from_formula(var2, context) +    var1 = _set_value_from_formula(var1, context, default_value) +    var2 = _set_value_from_formula(var2, context, default_value)      res = var1 == var2      if operator == '!=':          res = not res      return res  def _format_value(value, default_value): +    if hasattr(value, 'strftime'): +        c_locale = settings.LANGUAGE_CODE.split('-') +        if len(c_locale) == 2: +            c_locale[1] = c_locale[1].upper() +        c_locale = "_".join(c_locale) +        if locale.getlocale()[0] != c_locale: +            locale.setlocale(locale.LC_ALL, c_locale) +        if settings.DATE_FORMAT: +            value = unicode(value.strftime(settings.DATE_FORMAT).decode( +                                            locale.getlocale()[1]).lower()) +        else: +            value = unicode(value.strftime('%x').decode( +                                            locale.getlocale()[1]))      value = unicode(value) if value else default_value -    #if hasattr(value, 'strftime'): -    #    value = value.strftime()      return value  def ooo_replace(infile, outfile, context, default_value=''): @@ -76,7 +89,8 @@ def ooo_replace(infile, outfile, context, default_value=''):                  missing_keys.add(name)      for p in content.findall(".//"+OOO_NS+"conditional-text"):          condition = p.get(OOO_NS+"condition") -        res = 'true' if _parse_condition(condition, context) else 'false' +        res = 'true' if _parse_condition(condition, context, default_value) \ +              else 'false'          value = p.get(OOO_NS+'string-value-if-' + res)          value = _format_value(value, default_value)          if value.strip() in context: diff --git a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html index 76877a716..f67eb5c1e 100644 --- a/ishtar_common/templates/ishtar/wizard/confirm_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/confirm_wizard.html @@ -28,9 +28,14 @@      {{ wizard.form.as_table }}     </table>    {%endif%} -  <p>{%if confirm_end_msg %}{{confirm_end_msg|safe}}{%else%}{% trans "Would you like to save them?" %}{%endif%}</p>    <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />    {{ previous_fields|safe }} +  {% if extra_form %} +  <table> +  {{ extra_form }} +  </table> +  {% endif %} +  <p>{%if confirm_end_msg %}{{confirm_end_msg|safe}}{%else%}{% trans "Would you like to save them?" %}{%endif%}</p>    <input type="submit" value="{% trans "Validate" %}"/>  </div>  </form> diff --git a/ishtar_common/templates/ishtar/wizard/wizard_done.html b/ishtar_common/templates/ishtar/wizard/wizard_done.html index a7068bbab..7de3edfce 100644 --- a/ishtar_common/templates/ishtar/wizard/wizard_done.html +++ b/ishtar_common/templates/ishtar/wizard/wizard_done.html @@ -2,5 +2,10 @@  {% load i18n %}  {% block content %}  <p>{%trans "Item successfully saved"%}</p> +{% if redirect %} +<script type='text/javascript' language='javascript'> +window.location.href = "{{redirect}}"; +</script> +{% endif %}  </div>  {% endblock %} diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 31f5f688b..c992b1a76 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -52,7 +52,7 @@ from menus import menu  from ishtar_common.forms import FinalForm  from ishtar_common.forms_common import PersonForm, PersonTypeForm, \      PersonFormSelection, AccountForm, FinalAccountForm, OrganizationForm, \ -    AuthorForm +    AuthorForm, SimplePersonForm  from ishtar_common.wizards import PersonWizard, PersonModifWizard, AccountWizard  import models @@ -74,7 +74,7 @@ def index(request):                                context_instance=RequestContext(request))  person_creation_wizard = PersonWizard.as_view([ -                        ('identity-person_creation', PersonForm), +                        ('identity-person_creation', SimplePersonForm),                          ('person_type-person_creation', PersonTypeForm),                          ('final-person_creation', FinalForm)],                           label=_(u"New person"), @@ -82,7 +82,7 @@ person_creation_wizard = PersonWizard.as_view([  person_modification_wizard = PersonModifWizard.as_view([                        ('selec-person_modification', PersonFormSelection), -                      ('identity-person_modification', PersonForm), +                      ('identity-person_modification', SimplePersonForm),                        ('person_type-person_creation', PersonTypeForm),                        ('final-person_modification', FinalForm)],                         label=_(u"Person modification"),  | 
