summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/data_importer.py4
-rw-r--r--archaeological_files/forms.py30
-rw-r--r--archaeological_files/locale/django.pot118
-rw-r--r--archaeological_files/models.py4
-rw-r--r--archaeological_files/tests.py2
5 files changed, 84 insertions, 74 deletions
diff --git a/archaeological_files/data_importer.py b/archaeological_files/data_importer.py
index ba92c63ab..96b2ee007 100644
--- a/archaeological_files/data_importer.py
+++ b/archaeological_files/data_importer.py
@@ -23,7 +23,7 @@ import unicodecsv
from django.conf import settings
from ishtar_common.data_importer import *
-from ishtar_common.models import Person, OrganizationType
+from ishtar_common.models import OrganizationType
from archaeological_operations.data_importer import *
@@ -113,7 +113,7 @@ class FileImporterSraPdL(FilePostProcessing, Importer):
None, # D, 4
ImportFormater(
"general_contractor__title", # E, 5
- StrChoiceFormater(Person.TYPE, cli=True),
+ TypeFormater(models.TitleType),
required=False,
comment=u"Aménageur - titre"),
None, # F, 6
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 369ffdaf0..26b839940 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -33,7 +33,8 @@ from ishtar_common.models import Person, PersonType, Organization, \
from archaeological_operations.models import ActType, AdministrativeAct, \
OperationType
import models
-from ishtar_common.forms import FinalForm, get_now, reverse_lazy, TableSelect
+from ishtar_common.forms import FinalForm, get_now, reverse_lazy, TableSelect, \
+ ManageOldType
from ishtar_common.forms_common import get_town_field
from archaeological_operations.forms import AdministrativeActOpeForm, \
AdministrativeActOpeFormSelection, \
@@ -103,7 +104,8 @@ class FileSelect(TableSelect):
def __init__(self, *args, **kwargs):
super(FileSelect, self).__init__(*args, **kwargs)
- self.fields['saisine_type'].choices = models.SaisineType.get_types()
+ self.fields['saisine_type'].choices = \
+ models.SaisineType.get_types()
self.fields['saisine_type'].help_text = models.SaisineType.get_help()
self.fields['permit_type'].choices = models.PermitType.get_types()
self.fields['permit_type'].help_text = models.PermitType.get_help()
@@ -195,7 +197,7 @@ class DashboardForm(forms.Form):
return fltr
-class FileFormGeneral(forms.Form):
+class FileFormGeneral(ManageOldType, forms.Form):
form_label = _("General")
associated_models = {'in_charge': Person,
'related_file': models.File,
@@ -237,7 +239,8 @@ class FileFormGeneral(forms.Form):
def __init__(self, *args, **kwargs):
super(FileFormGeneral, self).__init__(*args, **kwargs)
- self.fields['file_type'].choices = models.FileType.get_types()
+ self.fields['file_type'].choices = models.FileType.get_types(
+ initial=self.init_data.get('file_type'))
self.fields['file_type'].help_text = models.FileType.get_help()
q = models.File.objects\
.filter(internal_reference__isnull=False)\
@@ -276,7 +279,7 @@ RESPONSIBLE_PLANNING_SERVICE_ORGA, created = \
OrganizationType.objects.get_or_create(txt_idx='planning_service')
-class FileFormPreventive(forms.Form):
+class FileFormPreventive(ManageOldType, forms.Form):
form_label = _(u"Preventive informations")
associated_models = {'general_contractor': Person,
'saisine_type': models.SaisineType,
@@ -322,14 +325,18 @@ class FileFormPreventive(forms.Form):
def __init__(self, *args, **kwargs):
super(FileFormPreventive, self).__init__(*args, **kwargs)
- self.fields['saisine_type'].choices = models.SaisineType.get_types()
- self.fields['saisine_type'].help_text = models.SaisineType.get_help()
+ if 'saisine_type' in self.fields:
+ self.fields['saisine_type'].choices = \
+ models.SaisineType.get_types(
+ initial=self.init_data.get('saisine_type'))
+ self.fields['saisine_type'].help_text = \
+ models.SaisineType.get_help()
self.fields['permit_type'].choices = models.PermitType.get_types(
- default='NP')
+ initial=self.init_data.get('permit_type'), default='NP')
self.fields['permit_type'].help_text = models.PermitType.get_help()
-class FileFormResearch(forms.Form):
+class FileFormResearch(ManageOldType, forms.Form):
form_label = _("Research archaeology")
base_model = 'department'
associated_models = {'scientist': Person,
@@ -376,7 +383,9 @@ class FileFormResearch(forms.Form):
def __init__(self, *args, **kwargs):
super(FileFormResearch, self).__init__(*args, **kwargs)
self.fields['requested_operation_type'].choices = \
- OperationType.get_types(dct={"preventive": False})
+ OperationType.get_types(
+ dct={"preventive": False},
+ initial=self.init_data.get('requested_operation_type'))
self.fields['requested_operation_type'].help_text = \
OperationType.get_help()
@@ -535,6 +544,7 @@ class AdministrativeActFileForm(AdministrativeActOpeForm):
def __init__(self, *args, **kwargs):
super(AdministrativeActFileForm, self).__init__(*args, **kwargs)
self.fields['act_type'].choices = ActType.get_types(
+ initial=self.init_data.get('act_type'),
dct={'intented_to': 'F'})
self.fields['act_type'].help_text = ActType.get_help(
dct={'intented_to': 'F'})
diff --git a/archaeological_files/locale/django.pot b/archaeological_files/locale/django.pot
index d1d5e5820..b8146add8 100644
--- a/archaeological_files/locale/django.pot
+++ b/archaeological_files/locale/django.pot
@@ -8,243 +8,243 @@
msgid ""
msgstr ""
-#: forms.py:51 forms.py:210 forms.py:254 forms.py:395 forms.py:422
+#: forms.py:52 forms.py:212 forms.py:257 forms.py:404 forms.py:431
#: models.py:76 templates/ishtar/sheet_file.html:139
msgid "Year"
msgstr ""
-#: forms.py:52 forms.py:215 forms.py:256 models.py:79
+#: forms.py:53 forms.py:217 forms.py:259 models.py:79
msgid "Numeric reference"
msgstr ""
-#: forms.py:54 forms.py:217
+#: forms.py:55 forms.py:219
msgid "Other reference"
msgstr ""
-#: forms.py:56 forms.py:430
+#: forms.py:57 forms.py:439
msgid "Parcel (section/number/public domain)"
msgstr ""
-#: forms.py:59 forms.py:406 forms.py:433 models.py:512
+#: forms.py:60 forms.py:415 forms.py:442 models.py:512
msgid "Department"
msgstr ""
-#: forms.py:60 forms.py:442
+#: forms.py:61 forms.py:451
msgid "File name"
msgstr ""
-#: forms.py:61 forms.py:156 forms.py:221 models.py:87
+#: forms.py:62 forms.py:158 forms.py:223 models.py:87
msgid "File type"
msgstr ""
-#: forms.py:62
+#: forms.py:63
msgid "Is active?"
msgstr ""
-#: forms.py:63 forms.py:158 forms.py:318
+#: forms.py:64 forms.py:160 forms.py:321
msgid "Saisine type"
msgstr ""
-#: forms.py:64 forms.py:308 models.py:58 models.py:118
+#: forms.py:65 forms.py:311 models.py:58 models.py:118
msgid "Permit type"
msgstr ""
-#: forms.py:66 forms.py:311 models.py:119
+#: forms.py:67 forms.py:314 models.py:119
msgid "Permit reference"
msgstr ""
-#: forms.py:67 forms.py:227 forms.py:365 models.py:148
+#: forms.py:68 forms.py:229 forms.py:372 models.py:148
#: templates/ishtar/sheet_file.html:94
msgid "Comment"
msgstr ""
-#: forms.py:69 templates/ishtar/sheet_file.html:112
+#: forms.py:70 templates/ishtar/sheet_file.html:112
msgid "In charge"
msgstr ""
-#: forms.py:76 forms.py:286 forms.py:444 models.py:94
+#: forms.py:77 forms.py:289 forms.py:453 models.py:94
msgid "General contractor"
msgstr ""
-#: forms.py:83 forms.py:453
+#: forms.py:84 forms.py:462
msgid "Organization of general contractor"
msgstr ""
-#: forms.py:90 forms.py:476
+#: forms.py:91 forms.py:485
msgid "Created by"
msgstr ""
-#: forms.py:97 forms.py:484
+#: forms.py:98 forms.py:493
msgid "Modified by"
msgstr ""
-#: forms.py:127
+#: forms.py:129
msgid "Archaeological file search"
msgstr ""
-#: forms.py:141
+#: forms.py:143
msgid "You should select a file."
msgstr ""
-#: forms.py:144 forms.py:219 models.py:127
+#: forms.py:146 forms.py:221 models.py:127
msgid "Creation date"
msgstr ""
-#: forms.py:145 forms.py:321 models.py:129
+#: forms.py:147 forms.py:324 models.py:129
msgid "Reception date"
msgstr ""
-#: forms.py:150
+#: forms.py:152
msgid "Slicing"
msgstr ""
-#: forms.py:152
+#: forms.py:154
msgid "Department detail"
msgstr ""
-#: forms.py:154
+#: forms.py:156
msgid "Date get from"
msgstr ""
-#: forms.py:160
+#: forms.py:162
msgid "Date after"
msgstr ""
-#: forms.py:162
+#: forms.py:164
msgid "Date before"
msgstr ""
-#: forms.py:199 templates/ishtar/sheet_file.html:14
+#: forms.py:201 templates/ishtar/sheet_file.html:14
msgid "General"
msgstr ""
-#: forms.py:204 models.py:89
+#: forms.py:206 models.py:89
msgid "Person in charge"
msgstr ""
-#: forms.py:218 models.py:86
+#: forms.py:220 models.py:86
msgid "Name"
msgstr ""
-#: forms.py:223 models.py:131
+#: forms.py:225 models.py:131
msgid "Related file"
msgstr ""
-#: forms.py:231 models.py:139
+#: forms.py:233 models.py:139
msgid "Total surface (m2)"
msgstr ""
-#: forms.py:234 models.py:145
+#: forms.py:236 models.py:145
msgid "Main address"
msgstr ""
-#: forms.py:235
+#: forms.py:237
msgid "Main address - complement"
msgstr ""
-#: forms.py:247
+#: forms.py:250
#, python-format
msgid "<br/>(last recorded: %s)"
msgstr ""
-#: forms.py:269
+#: forms.py:272
msgid "Another file with this numeric id exists."
msgstr ""
-#: forms.py:280
+#: forms.py:283
msgid "Preventive informations"
msgstr ""
-#: forms.py:298 models.py:106
+#: forms.py:301 models.py:106
msgid "Responsible for town planning service"
msgstr ""
-#: forms.py:314 models.py:142
+#: forms.py:317 models.py:142
msgid "Total developed surface (m2)"
msgstr ""
-#: forms.py:333 templates/ishtar/sheet_file.html:84
+#: forms.py:340 templates/ishtar/sheet_file.html:84
#: templates/ishtar/dashboards/dashboard_file.html:45
msgid "Research archaeology"
msgstr ""
-#: forms.py:341 models.py:151 templates/ishtar/sheet_file.html:85
+#: forms.py:348 models.py:151 templates/ishtar/sheet_file.html:85
msgid "Departments"
msgstr ""
-#: forms.py:352 models.py:160
+#: forms.py:359 models.py:160
msgid "Scientist in charge"
msgstr ""
-#: forms.py:354 models.py:154 templates/ishtar/sheet_file.html:87
+#: forms.py:361 models.py:154 templates/ishtar/sheet_file.html:87
msgid "Requested operation type"
msgstr ""
-#: forms.py:356
+#: forms.py:363
msgid "Lead organization"
msgstr ""
-#: forms.py:372 models.py:164 templates/ishtar/sheet_file.html:92
+#: forms.py:379 models.py:164 templates/ishtar/sheet_file.html:92
msgid "Classified area"
msgstr ""
-#: forms.py:374 models.py:166 templates/ishtar/sheet_file.html:93
+#: forms.py:381 models.py:166 templates/ishtar/sheet_file.html:93
msgid "Protected area"
msgstr ""
-#: forms.py:386
+#: forms.py:395
msgid "Would you like to close this archaeological file?"
msgstr ""
-#: forms.py:391
+#: forms.py:400
msgid "Would you like to delete this archaelogical file ?"
msgstr ""
-#: forms.py:396 forms.py:423 forms.py:546
+#: forms.py:405 forms.py:432 forms.py:556
msgid "Index"
msgstr ""
-#: forms.py:400 forms.py:427 forms.py:533
+#: forms.py:409 forms.py:436 forms.py:542
msgid "Act type"
msgstr ""
-#: forms.py:401
+#: forms.py:410
msgid "Object (full text search)"
msgstr ""
-#: forms.py:428
+#: forms.py:437
msgid "Indexed?"
msgstr ""
-#: forms.py:434
+#: forms.py:443
msgid "Object"
msgstr ""
-#: forms.py:438
+#: forms.py:447
msgid "Signature date after"
msgstr ""
-#: forms.py:440
+#: forms.py:449
msgid "Signature date before"
msgstr ""
-#: forms.py:461
+#: forms.py:470
msgid "File numeric reference"
msgstr ""
-#: forms.py:462
+#: forms.py:471
msgid "File year"
msgstr ""
-#: forms.py:464
+#: forms.py:473
msgid "File other reference"
msgstr ""
-#: forms.py:466
+#: forms.py:475
msgid "File in charge"
msgstr ""
-#: forms.py:474
+#: forms.py:483
msgid "File permit reference"
msgstr ""
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 1cfbe35d3..98223d7ff 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -30,7 +30,7 @@ from ishtar_common.utils import cached_label_changed, get_cache
from ishtar_common.models import GeneralType, BaseHistorizedItem, \
HistoricalRecords, OwnPerms, Person, Organization, Department, Town, \
- Dashboard, DashboardFormItem, IshtarUser, ValueGetter, ShortMenuItem, \
+ Dashboard, DashboardFormItem, ValueGetter, ShortMenuItem, \
OperationType, get_external_id
from archaeological_operations.models import get_values_town_related, \
@@ -243,7 +243,7 @@ class File(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
if self.general_contractor:
if self.general_contractor.name:
address = u" ".join([
- getattr(self.general_contractor, key)
+ unicode(getattr(self.general_contractor, key))
for key in ('title', 'surname', 'name')
if getattr(self.general_contractor, key)])
elif self.general_contractor.raw_name:
diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py
index 030bc1624..63b8550e2 100644
--- a/archaeological_files/tests.py
+++ b/archaeological_files/tests.py
@@ -50,7 +50,7 @@ class FileInit(object):
self.extra_models['person_type'] = person_type
self.model_list.append(person_type)
- person = models.Person(title='Mr', surname='Surname', name='Name',
+ person = models.Person(surname='Surname', name='Name',
history_modifier=self.o_user)
person.save()
self.extra_models['person'] = person