summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-02-26 20:52:11 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-02-26 20:52:11 +0100
commitf72f7d90893b4f4ae0e000563b7c20faeefc8f18 (patch)
tree8c8f06c9fb974edde62e82875f7a1b8aad49d7c3 /archaeological_operations
parent90b20a15bd6bf4f7808957bb8820f10f0d66d5e8 (diff)
parent0cd8904defe334ad5307e6ab3ce13638479815a8 (diff)
downloadIshtar-f72f7d90893b4f4ae0e000563b7c20faeefc8f18.tar.bz2
Ishtar-f72f7d90893b4f4ae0e000563b7c20faeefc8f18.zip
Merge branch 'master' into v0.9
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/admin.py20
-rw-r--r--archaeological_operations/forms.py83
-rw-r--r--archaeological_operations/import_from_csv.py6
-rw-r--r--archaeological_operations/import_from_dbf.py6
-rw-r--r--archaeological_operations/ishtar_menu.py99
-rw-r--r--archaeological_operations/locale/django.pot531
-rw-r--r--archaeological_operations/models.py443
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html20
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html17
-rw-r--r--archaeological_operations/templatetags/window_ope_tables.py9
-rw-r--r--archaeological_operations/views.py15
-rw-r--r--archaeological_operations/wizards.py8
12 files changed, 642 insertions, 615 deletions
diff --git a/archaeological_operations/admin.py b/archaeological_operations/admin.py
index 2a0ec652c..34e6da2ca 100644
--- a/archaeological_operations/admin.py
+++ b/archaeological_operations/admin.py
@@ -24,17 +24,15 @@ from ishtar_common.admin import HistorizedObjectAdmin, GeneralTypeAdmin
import models
-FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
-if FILES_AVAILABLE:
- class AdministrativeActAdmin(HistorizedObjectAdmin):
- list_display = ('year', 'index', 'operation', 'associated_file',
- 'act_type')
- list_filter = ('act_type',)
- search_fields = ('year', 'index')
- model = models.AdministrativeAct
+class AdministrativeActAdmin(HistorizedObjectAdmin):
+ list_display = ('year', 'index', 'operation', 'associated_file',
+ 'act_type')
+ list_filter = ('act_type',)
+ search_fields = ('year', 'index')
+ model = models.AdministrativeAct
- admin.site.register(models.AdministrativeAct, AdministrativeActAdmin)
+admin.site.register(models.AdministrativeAct, AdministrativeActAdmin)
class PeriodAdmin(admin.ModelAdmin):
@@ -78,9 +76,7 @@ admin.site.register(models.OperationSource, OperationSourceAdmin)
class ParcelAdmin(HistorizedObjectAdmin):
- list_display = ['section', 'parcel_number', 'operation']
- if FILES_AVAILABLE:
- list_display.append('associated_file')
+ list_display = ['section', 'parcel_number', 'operation', 'associated_file']
search_fields = ('operation__name',)
model = models.Parcel
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index d2ec086ae..84af8f287 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -34,14 +34,11 @@ from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.utils.safestring import mark_safe
from ishtar_common.models import valid_id, PersonType, Person, Town, \
- DocumentTemplate, Organization, OrganizationType
+ DocumentTemplate, Organization, OrganizationType, get_current_profile
from ishtar_common.wizards import MultiValueDict
-FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
-
-if FILES_AVAILABLE:
- from archaeological_files.models import File
+from archaeological_files.models import File
import models
from widgets import ParcelWidget, SelectParcelWidget
@@ -411,16 +408,16 @@ OPERATOR, created = OrganizationType.objects.get_or_create(txt_idx='operator')
class OperationSelect(TableSelect):
+ year = forms.IntegerField(label=_("Year"))
+ operation_code = forms.IntegerField(label=_(u"Numeric reference"))
if settings.COUNTRY == 'fr':
code_patriarche = forms.IntegerField(
label="Numéro d'opération (OA Patriarche)")
- year = forms.IntegerField(label=_("Year"))
- operation_code = forms.IntegerField(label=_(u"Numeric reference"))
towns = get_town_field()
parcel = ParcelField(label=_("Parcel (section/number)"))
if settings.ISHTAR_DPTS:
towns__numero_insee__startswith = forms.ChoiceField(
- label="Department", choices=[])
+ label=_(u"Department"), choices=[])
common_name = forms.CharField(label=_(u"Name"),
max_length=30)
operation_type = forms.ChoiceField(label=_(u"Operation type"),
@@ -469,12 +466,12 @@ class OperationSelect(TableSelect):
report_processing = forms.ChoiceField(label=_(u"Report processing"),
choices=[])
virtual_operation = forms.NullBooleanField(label=_(u"Virtual operation"))
- archaeological_sites = forms.IntegerField(
- label=_("Archaelogical site"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-archaeologicalsite'),
- associated_model=models.ArchaeologicalSite),
- validators=[valid_id(models.ArchaeologicalSite)])
+ # archaeological_sites = forms.IntegerField(
+ # label=_("Archaelogical site"),
+ # widget=widgets.JQueryAutoComplete(
+ # reverse_lazy('autocomplete-archaeologicalsite'),
+ # associated_model=models.ArchaeologicalSite),
+ # validators=[valid_id(models.ArchaeologicalSite)])
history_creator = forms.IntegerField(
label=_(u"Created by"),
widget=widgets.JQueryAutoComplete(
@@ -566,16 +563,16 @@ class OperationCodeInput(forms.TextInput):
'url': reverse_lazy('get_available_operation_code')}
return mark_safe(rendered + js)
-if FILES_AVAILABLE:
- class OperationFormFileChoice(forms.Form):
- form_label = _(u"Associated file")
- associated_models = {'associated_file': File, }
- currents = {'associated_file': File}
- associated_file = forms.IntegerField(
- label=_(u"Archaelogical file"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-file'), associated_model=File),
- validators=[valid_id(File)], required=False)
+
+class OperationFormFileChoice(forms.Form):
+ form_label = _(u"Associated file")
+ associated_models = {'associated_file': File, }
+ currents = {'associated_file': File}
+ associated_file = forms.IntegerField(
+ label=_(u"Archaelogical file"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-file'), associated_model=File),
+ validators=[valid_id(File)], required=False)
class OperationFormAbstract(forms.Form):
@@ -814,14 +811,13 @@ class OperationFormGeneral(forms.Form):
class OperationFormModifGeneral(OperationFormGeneral):
operation_code = forms.IntegerField(label=_(u"Operation code"),
required=False)
- if FILES_AVAILABLE:
- currents = {'associated_file': File}
- associated_file = forms.IntegerField(
- label=_(u"Archaelogical file"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-file'),
- associated_model=File),
- validators=[valid_id(File)], required=False)
+ currents = {'associated_file': File}
+ associated_file = forms.IntegerField(
+ label=_(u"Archaelogical file"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-file'),
+ associated_model=File),
+ validators=[valid_id(File)], required=False)
def __init__(self, *args, **kwargs):
super(OperationFormModifGeneral, self).__init__(*args, **kwargs)
@@ -829,12 +825,13 @@ class OperationFormModifGeneral(OperationFormGeneral):
self.fields.keyOrder.pop(self.fields.keyOrder.index('associated_file'))
self.fields.keyOrder.insert(self.fields.keyOrder.index('in_charge'),
'associated_file')
+ if not get_current_profile().files:
+ self.fields.pop('associated_file')
OperationFormModifGeneral.associated_models = \
OperationFormGeneral.associated_models.copy()
-if FILES_AVAILABLE:
- OperationFormModifGeneral.associated_models['associated_file'] = File
+OperationFormModifGeneral.associated_models['associated_file'] = File
class OperationFormPreventive(forms.Form):
@@ -993,6 +990,24 @@ class ArchaeologicalSiteForm(forms.Form):
return item
+class ArchaeologicalSiteBasicForm(forms.Form):
+ form_label = _("Archaeological site")
+ base_model = 'archaeological_site'
+ associated_models = {'archaeological_site': models.ArchaeologicalSite}
+ archaeological_site = forms.IntegerField(
+ label=_("Archaelogical site"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-archaeologicalsite'),
+ associated_model=models.ArchaeologicalSite,
+ new=True),
+ validators=[valid_id(models.ArchaeologicalSite)])
+
+
+ArchaeologicalSiteFormSet = formset_factory(ArchaeologicalSiteBasicForm,
+ can_delete=True, formset=FormSet)
+ArchaeologicalSiteFormSet.form_label = _("Archaeological sites")
+
+
class ArchaeologicalSiteSelectionForm(forms.Form):
form_label = _("Associated archaelogical sites")
archaeological_sites = forms.IntegerField(
diff --git a/archaeological_operations/import_from_csv.py b/archaeological_operations/import_from_csv.py
index 714825ff4..45faae632 100644
--- a/archaeological_operations/import_from_csv.py
+++ b/archaeological_operations/import_from_csv.py
@@ -403,18 +403,18 @@ def import_operations_csv(values, col_defs=OPE_COLS, update=True, person=None,
errors = []
if error_ope:
- error = "Error while recording theses operations:\n"
+ error = "Error while recording these operations:\n"
for line_idx, args in error_ope:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
if error_multis:
- error = "Error while recording theses multiples items attached to "\
+ error = "Error while recording these multiples items attached to "\
"operation:"
for line_idx, args in error_multis:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
if error_reversed:
- error = "Error while recording theses items that depend to operation:"
+ error = "Error while recording these items that depend to operation:"
for line_idx, args in error_reversed:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
diff --git a/archaeological_operations/import_from_dbf.py b/archaeological_operations/import_from_dbf.py
index 1e3d6a0ea..3ce41fdfc 100644
--- a/archaeological_operations/import_from_dbf.py
+++ b/archaeological_operations/import_from_dbf.py
@@ -308,18 +308,18 @@ def import_operations_dbf(values, col_defs=DBF_OPE_COLS, update=False,
if nb_error:
errors.append(ERROR_LBLS[error_key] + str(nb_error))
if error_ope:
- error = "Error while recording theses operations:\n"
+ error = "Error while recording these operations:\n"
for line_idx, args in error_ope:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
if error_multis:
- error = "Error while recording theses multiples items attached to "\
+ error = "Error while recording these multiples items attached to "\
"operation:"
for line_idx, args in error_multis:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
if error_reversed:
- error = "Error while recording theses items that depend to operation:"
+ error = "Error while recording these items that depend to operation:"
for line_idx, args in error_reversed:
error += "line: " + str(line_idx) + " args: " + str(args) + '\n'
errors.append(error)
diff --git a/archaeological_operations/ishtar_menu.py b/archaeological_operations/ishtar_menu.py
index 60f764ab7..a0852147a 100644
--- a/archaeological_operations/ishtar_menu.py
+++ b/archaeological_operations/ishtar_menu.py
@@ -17,7 +17,6 @@
# See the file COPYING for details.
-from django.conf import settings
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from ishtar_common.menu_base import SectionItem, MenuItem
@@ -26,8 +25,6 @@ import models
# be carreful: each access_controls must be relevant with check_rights in urls
-FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
-
MENU_SECTIONS = [
(30, SectionItem(
'operation_management', _(u"Operation"),
@@ -57,6 +54,38 @@ MENU_SECTIONS = [
access_controls=['change_operation',
'change_own_operation']),
SectionItem(
+ 'admin_act_operations',
+ _(u"Administrative act"),
+ profile_restriction='files',
+ childs=[
+ MenuItem(
+ 'operation_administrativeactop_search',
+ _(u"Search"),
+ model=models.AdministrativeAct,
+ access_controls=[
+ 'change_administrativeact']),
+ MenuItem(
+ 'operation_administrativeactop',
+ _(u"Add"),
+ model=models.AdministrativeAct,
+ access_controls=['change_administrativeact']),
+ MenuItem(
+ 'operation_administrativeactop_modification',
+ _(u"Modification"),
+ model=models.AdministrativeAct,
+ access_controls=['change_administrativeact']),
+ MenuItem(
+ 'operation_administrativeactop_deletion',
+ _(u"Deletion"),
+ model=models.AdministrativeAct,
+ access_controls=['change_administrativeact']),
+ MenuItem(
+ 'operation_administrativeact_document',
+ _(u"Documents"),
+ model=models.AdministrativeAct,
+ access_controls=['change_administrativeact']),
+ ],),
+ SectionItem(
'operation_source', _(u"Documentation"),
childs=[
MenuItem('operation_source_search',
@@ -83,6 +112,19 @@ MENU_SECTIONS = [
]),
),
(
+ 35, SectionItem(
+ 'administrativact_management', _(u"Administrative Act"),
+ profile_restriction='files',
+ childs=[
+ MenuItem(
+ 'administrativact_register',
+ pgettext_lazy('admin act register', u"Register"),
+ model=models.AdministrativeAct,
+ access_controls=['view_administrativeact',
+ 'view_own_administrativeact']),
+ ])
+ ),
+ (
102, SectionItem(
'dashboard', _(u"Dashboard"),
childs=[
@@ -97,54 +139,3 @@ MENU_SECTIONS = [
]),
),
]
-
-if FILES_AVAILABLE:
- MENU_SECTIONS.insert(
- 1,
- (
- 35, SectionItem(
- 'administrativact_management', _(u"Administrative Act"),
- childs=[
- MenuItem(
- 'administrativact_register',
- pgettext_lazy('admin act register', u"Register"),
- model=models.AdministrativeAct,
- access_controls=['view_administrativeact',
- 'view_own_administrativeact']),
- ])
- )
- )
- MENU_SECTIONS[0][1].childs.insert(
- 5,
- SectionItem(
- 'admin_act_operations',
- _(u"Administrative act"),
- childs=[
- MenuItem(
- 'operation_administrativeactop_search',
- _(u"Search"),
- model=models.AdministrativeAct,
- access_controls=[
- 'change_administrativeact']),
- MenuItem(
- 'operation_administrativeactop',
- _(u"Add"),
- model=models.AdministrativeAct,
- access_controls=['change_administrativeact']),
- MenuItem(
- 'operation_administrativeactop_modification',
- _(u"Modification"),
- model=models.AdministrativeAct,
- access_controls=['change_administrativeact']),
- MenuItem(
- 'operation_administrativeactop_deletion',
- _(u"Deletion"),
- model=models.AdministrativeAct,
- access_controls=['change_administrativeact']),
- MenuItem(
- 'operation_administrativeact_document',
- _(u"Documents"),
- model=models.AdministrativeAct,
- access_controls=['change_administrativeact']),
- ],)
- )
diff --git a/archaeological_operations/locale/django.pot b/archaeological_operations/locale/django.pot
index a112d4d16..b78e36c6c 100644
--- a/archaeological_operations/locale/django.pot
+++ b/archaeological_operations/locale/django.pot
@@ -3,16 +3,16 @@
# This file is distributed under the same license as the Ishtar package.
# Étienne Loks <etienne.loks at peacefrogs net>, 2010-2015.
# Étienne Loks <etienne.loks@iggdrasil.net>, 2015. #zanata
-# Étienne Loks <etienne.loks@iggdrasil.net>, 2016. #zanata
+# Valérie-Emma Leroux <emma@iggdrasil.net>, 2016. #zanata
msgid ""
msgstr ""
-#: forms.py:69 forms.py:336 forms.py:895 forms.py:917 forms.py:921
-#: models.py:791 templates/ishtar/blocks/window_tables/parcels.html:8
+#: forms.py:66 forms.py:333 forms.py:892 forms.py:914 forms.py:918
+#: models.py:780 templates/ishtar/blocks/window_tables/parcels.html:8
msgid "Parcels"
msgstr ""
-#: forms.py:72 forms.py:188 forms.py:871 models.py:781
+#: forms.py:69 forms.py:185 forms.py:868 models.py:770
#: templates/ishtar/blocks/window_tables/parcels.html:5
#: templates/ishtar/dashboards/dashboard_operation.html:302
#: templates/ishtar/dashboards/dashboard_operation.html:315
@@ -21,887 +21,892 @@ msgstr ""
msgid "Town"
msgstr ""
-#: forms.py:74 forms.py:417 forms.py:685 forms.py:1084 models.py:161
-#: models.py:597 models.py:779
+#: forms.py:71 forms.py:411 forms.py:682 forms.py:1099 models.py:158
+#: models.py:587 models.py:768
#: templates/ishtar/blocks/window_tables/parcels.html:6
msgid "Year"
msgstr ""
-#: forms.py:77 models.py:782
+#: forms.py:74 models.py:771
#: templates/ishtar/blocks/window_tables/parcels.html:7
msgid "Section"
msgstr ""
-#: forms.py:80 models.py:783
+#: forms.py:77 models.py:772
msgid "Parcel number"
msgstr ""
-#: forms.py:110
+#: forms.py:107
msgid "Town section and parcel number fields are required."
msgstr ""
-#: forms.py:153
+#: forms.py:150
msgid "Current parcels"
msgstr ""
-#: forms.py:155
+#: forms.py:152
msgid "Deleted parcels"
msgstr ""
-#: forms.py:191
+#: forms.py:188
msgid "Full text input"
msgstr ""
-#: forms.py:193
+#: forms.py:190
msgid "example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or \"AB:24,AC:42\""
msgstr ""
-#: forms.py:330
+#: forms.py:327
msgid "There are identical parcels."
msgstr ""
-#: forms.py:345
+#: forms.py:342
msgid "Relation type"
msgstr ""
-#: forms.py:348 ishtar_menu.py:33 models.py:241 models.py:496 models.py:521
-#: models.py:536 models.py:588 models.py:778 wizards.py:341 wizards.py:352
+#: forms.py:345 ishtar_menu.py:30 models.py:237 models.py:488 models.py:513
+#: models.py:528 models.py:579 models.py:767 wizards.py:338 wizards.py:349
#: templates/ishtar/sheet_operation.html:6
msgid "Operation"
msgstr ""
-#: forms.py:367
+#: forms.py:364
msgid ":"
msgstr ""
-#: forms.py:398
+#: forms.py:395
msgid "Current relations"
msgstr ""
-#: forms.py:400
+#: forms.py:397
msgid "Deleted relations"
msgstr ""
-#: forms.py:404 templates/ishtar/sheet_operation.html:113
+#: forms.py:401 templates/ishtar/sheet_operation.html:115
msgid "Relations"
msgstr ""
-#: forms.py:418
+#: forms.py:412
msgid "Numeric reference"
msgstr ""
-#: forms.py:420 forms.py:1094
+#: forms.py:417 forms.py:1109
msgid "Parcel (section/number)"
msgstr ""
-#: forms.py:424 forms.py:956 models.py:79
+#: forms.py:420 forms.py:1112 models.py:489
+#: 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 ""
+
+#: forms.py:421 forms.py:953 models.py:77
+#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:6
msgid "Name"
msgstr ""
-#: forms.py:426 forms.py:607 forms.py:683 forms.py:1061 models.py:170
+#: forms.py:423 forms.py:604 forms.py:680 forms.py:1076 models.py:166
msgid "Operation type"
msgstr ""
-#: forms.py:428
+#: forms.py:425
msgid "Is open?"
msgstr ""
-#: forms.py:437 forms.py:713 models.py:158
+#: forms.py:434 forms.py:710 models.py:155
msgid "In charge"
msgstr ""
-#: forms.py:444 models.py:582
+#: forms.py:441 models.py:573
msgid "Scientist in charge"
msgstr ""
-#: forms.py:446 forms.py:609 forms.py:704 models.py:156
+#: forms.py:443 forms.py:606 forms.py:701 models.py:153
msgid "Operator"
msgstr ""
-#: forms.py:453 forms.py:961 models.py:83 models.py:172
+#: forms.py:450 forms.py:958 models.py:81 models.py:168
+#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:8
msgid "Remains"
msgstr ""
-#: forms.py:454 forms.py:940 forms.py:958 models.py:81 models.py:177
+#: forms.py:451 forms.py:937 forms.py:955 models.py:79 models.py:173
+#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:7
msgid "Periods"
msgstr ""
-#: forms.py:455
+#: forms.py:452
msgid "Started before"
msgstr ""
-#: forms.py:457
+#: forms.py:454
msgid "Started after"
msgstr ""
-#: forms.py:459
+#: forms.py:456
msgid "Ended before"
msgstr ""
-#: forms.py:461
+#: forms.py:458
msgid "Ended after"
msgstr ""
-#: forms.py:464
+#: forms.py:461
msgid "Search within relations"
msgstr ""
-#: forms.py:466 forms.py:755 models.py:223
+#: forms.py:463 forms.py:752 models.py:219
msgid "Comment"
msgstr ""
-#: forms.py:467
+#: forms.py:464
msgid "Abstract (full text search)"
msgstr ""
-#: forms.py:468 forms.py:757 models.py:235
+#: forms.py:465 forms.py:754 models.py:231
msgid "Record quality"
msgstr ""
-#: forms.py:469 forms.py:736 models.py:189
+#: forms.py:466 forms.py:733 models.py:185
msgid "Report processing"
msgstr ""
-#: forms.py:471 forms.py:760 models.py:230
+#: forms.py:468 forms.py:757 models.py:226
msgid "Virtual operation"
msgstr ""
-#: forms.py:473
-msgid "Archaelogical site"
-msgstr ""
-
-#: forms.py:479 forms.py:1101
+#: forms.py:476 forms.py:1116
msgid "Created by"
msgstr ""
-#: forms.py:485 forms.py:1107
+#: forms.py:482 forms.py:1122
msgid "Modified by"
msgstr ""
-#: forms.py:527 forms.py:1054 views.py:230
+#: forms.py:524 forms.py:1069 views.py:231
msgid "Operation search"
msgstr ""
-#: forms.py:540 forms.py:1056
+#: forms.py:537 forms.py:1071
msgid "You should select an operation."
msgstr ""
-#: forms.py:571
+#: forms.py:568
msgid "Associated file"
msgstr ""
-#: forms.py:575 forms.py:820 models.py:594 wizards.py:78
+#: forms.py:572 forms.py:816 models.py:584 wizards.py:76
msgid "Archaelogical file"
msgstr ""
-#: forms.py:582 forms.py:584 models.py:237
+#: forms.py:579 forms.py:581 models.py:233
msgid "Abstract"
msgstr ""
-#: forms.py:587
+#: forms.py:584
msgid "months"
msgstr ""
-#: forms.py:587
+#: forms.py:584
msgid "years"
msgstr ""
-#: forms.py:589 models.py:142
+#: forms.py:586 models.py:139
msgid "Creation date"
msgstr ""
-#: forms.py:590
+#: forms.py:587
msgid "Start of field work"
msgstr ""
-#: forms.py:592
+#: forms.py:589
msgid "All"
msgstr ""
-#: forms.py:593
+#: forms.py:590
msgid "Preventive"
msgstr ""
-#: forms.py:594
+#: forms.py:591
msgid "Research"
msgstr ""
-#: forms.py:598
+#: forms.py:595
msgid "Slicing"
msgstr ""
-#: forms.py:601
+#: forms.py:598
msgid "Department detail"
msgstr ""
-#: forms.py:603
+#: forms.py:600
msgid "Date get from"
msgstr ""
-#: forms.py:605
+#: forms.py:602
msgid "Preventive/Research"
msgstr ""
-#: forms.py:611
+#: forms.py:608
msgid "Date after"
msgstr ""
-#: forms.py:613
+#: forms.py:610
msgid "Date before"
msgstr ""
-#: forms.py:615
+#: forms.py:612
msgid "With reports"
msgstr ""
-#: forms.py:616
+#: forms.py:613
msgid "With finds"
msgstr ""
-#: forms.py:668 forms.py:1154 templates/ishtar/sheet_administrativeact.html:11
+#: forms.py:665 forms.py:1169 templates/ishtar/sheet_administrativeact.html:11
#: templates/ishtar/sheet_operation.html:32
msgid "General"
msgstr ""
-#: forms.py:681 models.py:222
+#: forms.py:678 models.py:218
msgid "Generic name"
msgstr ""
-#: forms.py:690 forms.py:815 models.py:162 models.py:375
+#: forms.py:687 forms.py:812 models.py:159 models.py:368
msgid "Operation code"
msgstr ""
-#: forms.py:694
+#: forms.py:691
msgid "Head scientist"
msgstr ""
-#: forms.py:710 models.py:221
+#: forms.py:707 models.py:217
msgid "Operator reference"
msgstr ""
-#: forms.py:722
+#: forms.py:719
msgid "Total surface (m2)"
msgstr ""
-#: forms.py:727
+#: forms.py:724
msgid "Associated archaeological sites"
msgstr ""
-#: forms.py:729 models.py:51 models.py:145 models.py:951
+#: forms.py:726 models.py:49 models.py:142 models.py:938
msgid "Start date"
msgstr ""
-#: forms.py:731 models.py:147
+#: forms.py:728 models.py:144
msgid "Excavation end date"
msgstr ""
-#: forms.py:734 models.py:148
+#: forms.py:731 models.py:145
msgid "Report delivery date"
msgstr ""
-#: forms.py:785
+#: forms.py:782
msgid ""
"If you want to set an excavation end date you have to provide a start date."
msgstr ""
-#: forms.py:790
+#: forms.py:787
msgid "The excavation end date cannot be before the start date."
msgstr ""
-#: forms.py:805
+#: forms.py:802
#, python-format
msgid ""
"Operation code already exist for year: %(year)d - use a value bigger than "
"%(last_val)d"
msgstr ""
-#: forms.py:809
+#: forms.py:806
msgid "Bad operation code"
msgstr ""
-#: forms.py:841
+#: forms.py:838
msgid "Preventive informations - excavation"
msgstr ""
-#: forms.py:842 models.py:175
+#: forms.py:839 models.py:171
#: templates/ishtar/dashboards/dashboard_operation.html:495
msgid "Cost (euros)"
msgstr ""
-#: forms.py:843 models.py:180
+#: forms.py:840 models.py:176
msgid "Scheduled man-days"
msgstr ""
-#: forms.py:845 models.py:183
+#: forms.py:842 models.py:179
msgid "Optional man-days"
msgstr ""
-#: forms.py:847 models.py:186
+#: forms.py:844 models.py:182
msgid "Effective man-days"
msgstr ""
-#: forms.py:857
+#: forms.py:854
msgid "Preventive informations - diagnostic"
msgstr ""
-#: forms.py:860 models.py:205
+#: forms.py:857 models.py:201
msgid "Prescription on zoning"
msgstr ""
-#: forms.py:862 models.py:208
+#: forms.py:859 models.py:204
msgid "Prescription on large area"
msgstr ""
-#: forms.py:865 models.py:210
+#: forms.py:862 models.py:206
msgid "Prescription on geoarchaeological context"
msgstr ""
-#: forms.py:869 forms.py:891 models.py:174 models.py:607
+#: forms.py:866 forms.py:888 models.py:170 models.py:597
msgid "Towns"
msgstr ""
-#: forms.py:898 models.py:790 models.py:949
+#: forms.py:895 models.py:779 models.py:936
msgid "Parcel"
msgstr ""
-#: forms.py:925 models.py:45
+#: forms.py:922 models.py:43
msgid "Remain types"
msgstr ""
-#: forms.py:929 models.py:44
+#: forms.py:926 models.py:42
msgid "Remain type"
msgstr ""
-#: forms.py:944
+#: forms.py:941
msgid "Period"
msgstr ""
-#: forms.py:955 models.py:78
+#: forms.py:952 models.py:76
msgid "Reference"
msgstr ""
-#: forms.py:980
+#: forms.py:977
msgid "This reference already exists."
msgstr ""
-#: forms.py:997
+#: forms.py:994 models.py:85
+msgid "Archaeological site"
+msgstr ""
+
+#: forms.py:998
+msgid "Archaelogical site"
+msgstr ""
+
+#: forms.py:1008 models.py:86 models.py:223
+#: templates/ishtar/sheet_operation.html:126
+msgid "Archaeological sites"
+msgstr ""
+
+#: forms.py:1012
msgid "Associated archaelogical sites"
msgstr ""
-#: forms.py:1003 ishtar_menu.py:36 ishtar_menu.py:63 ishtar_menu.py:125
+#: forms.py:1018 ishtar_menu.py:33 ishtar_menu.py:63 ishtar_menu.py:92
msgid "Search"
msgstr ""
-#: forms.py:1008
+#: forms.py:1023
msgid "Would you like to close this operation?"
msgstr ""
-#: forms.py:1013
+#: forms.py:1028
msgid "Would you like to delete this operation?"
msgstr ""
-#: forms.py:1022 forms.py:1085 models.py:523 models.py:573
+#: forms.py:1037 forms.py:1100 models.py:515 models.py:564
msgid "Index"
msgstr ""
-#: forms.py:1048
+#: forms.py:1063
#, python-format
msgid ""
"Index already exists for operation: %(operation)s - use a value bigger than "
"%(last_val)d"
msgstr ""
-#: forms.py:1060
+#: forms.py:1075
msgid "Operation's town"
msgstr ""
-#: forms.py:1063
+#: forms.py:1078
msgid "Operation's year"
msgstr ""
-#: forms.py:1074
+#: forms.py:1089
msgid "Documentation search"
msgstr ""
-#: forms.py:1076
+#: forms.py:1091
msgid "You should select a document."
msgstr ""
-#: forms.py:1091 forms.py:1157 models.py:547 models.py:567
+#: forms.py:1106 forms.py:1172 models.py:539 models.py:558
msgid "Act type"
msgstr ""
-#: forms.py:1092 forms.py:1245
+#: forms.py:1107 forms.py:1260
msgid "Indexed?"
msgstr ""
-#: forms.py:1097 models.py:497
-#: 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 ""
-
-#: forms.py:1098 forms.py:1162 models.py:598
+#: forms.py:1113 forms.py:1177 models.py:588
#: templates/ishtar/blocks/window_tables/administrativacts.html:8
msgid "Object"
msgstr ""
-#: forms.py:1134 views.py:366
+#: forms.py:1149 views.py:373
msgid "Administrative act search"
msgstr ""
-#: forms.py:1149 forms.py:1203 forms.py:1270
+#: forms.py:1164 forms.py:1218 forms.py:1285
msgid "You should select an administrative act."
msgstr ""
-#: forms.py:1165 models.py:595
+#: forms.py:1180 models.py:585
msgid "Signature date"
msgstr ""
-#: forms.py:1180
+#: forms.py:1195
msgid "Would you like to delete this administrative act?"
msgstr ""
-#: forms.py:1185
+#: forms.py:1200
msgid "Template"
msgstr ""
-#: forms.py:1209 forms.py:1213
+#: forms.py:1224 forms.py:1228
msgid "This document is not intended for this type of act."
msgstr ""
-#: forms.py:1231
+#: forms.py:1246
msgid "Doc generation"
msgstr ""
-#: forms.py:1233
+#: forms.py:1248
msgid "Generate the associated doc?"
msgstr ""
-#: forms.py:1254 ishtar_menu.py:110 views.py:400
+#: forms.py:1269 ishtar_menu.py:121 views.py:407
msgctxt "admin act register"
msgid "Register"
msgstr ""
-#: ishtar_menu.py:41
+#: ishtar_menu.py:38
msgid "Creation"
msgstr ""
-#: ishtar_menu.py:46 ishtar_menu.py:73 ishtar_menu.py:136
+#: ishtar_menu.py:43 ishtar_menu.py:74 ishtar_menu.py:102
msgid "Modification"
msgstr ""
-#: ishtar_menu.py:51
+#: ishtar_menu.py:48
msgid "Closing"
msgstr ""
-#: ishtar_menu.py:55 ishtar_menu.py:78 ishtar_menu.py:141
+#: ishtar_menu.py:52 ishtar_menu.py:79 ishtar_menu.py:107
msgid "Deletion"
msgstr ""
-#: ishtar_menu.py:60
-msgid "Documentation"
+#: ishtar_menu.py:58 models.py:604
+#: templates/ishtar/sheet_administrativeact.html:6
+msgid "Administrative act"
msgstr ""
-#: ishtar_menu.py:68 ishtar_menu.py:131 widgets.py:52
+#: ishtar_menu.py:69 ishtar_menu.py:97 widgets.py:52
msgid "Add"
msgstr ""
-#: ishtar_menu.py:87
-msgid "Dashboard"
+#: ishtar_menu.py:84
+msgid "Documents"
msgstr ""
-#: ishtar_menu.py:90
-msgid "General informations"
+#: ishtar_menu.py:89
+msgid "Documentation"
msgstr ""
-#: ishtar_menu.py:94 models.py:242
-#: templates/ishtar/dashboards/dashboard_operation.html:9
-msgid "Operations"
+#: ishtar_menu.py:116
+msgid "Administrative Act"
msgstr ""
-#: ishtar_menu.py:106
-msgid "Administrative Act"
+#: ishtar_menu.py:129
+msgid "Dashboard"
msgstr ""
-#: ishtar_menu.py:121 models.py:614
-#: templates/ishtar/sheet_administrativeact.html:6
-msgid "Administrative act"
+#: ishtar_menu.py:132
+msgid "General informations"
msgstr ""
-#: ishtar_menu.py:146
-msgid "Documents"
+#: ishtar_menu.py:136 models.py:238
+#: templates/ishtar/dashboards/dashboard_operation.html:9
+msgid "Operations"
msgstr ""
-#: models.py:50 models.py:66 models.py:1413
+#: models.py:48 models.py:64 models.py:1400
msgid "Order"
msgstr ""
-#: models.py:52 models.py:952
+#: models.py:50 models.py:939
msgid "End date"
msgstr ""
-#: models.py:53
+#: models.py:51
msgid "Parent period"
msgstr ""
-#: models.py:57
+#: models.py:55
msgid "Type Period"
msgstr ""
-#: models.py:58
+#: models.py:56
msgid "Types Period"
msgstr ""
-#: models.py:69
+#: models.py:67
msgid "Report state"
msgstr ""
-#: models.py:70
+#: models.py:68
msgid "Report states"
msgstr ""
-#: models.py:87
-msgid "Archaeological site"
-msgstr ""
-
-#: models.py:88 models.py:227
-msgid "Archaeological sites"
+#: models.py:89
+msgid "Can view all Archaeological sites"
msgstr ""
#: models.py:91
-msgid "Can view all Archaeological site"
-msgstr ""
-
-#: models.py:93
msgid "Can view own Archaeological site"
msgstr ""
-#: models.py:95
+#: models.py:93
msgid "Can add own Archaeological site"
msgstr ""
-#: models.py:97
+#: models.py:95
msgid "Can change own Archaeological site"
msgstr ""
-#: models.py:99
+#: models.py:97
msgid "Can delete own Archaeological site"
msgstr ""
-#: models.py:129
+#: models.py:127
msgid "Not documented"
msgstr ""
-#: models.py:130
+#: models.py:128
msgid "Arbitrary"
msgstr ""
-#: models.py:131
+#: models.py:129
msgid "Reliable"
msgstr ""
-#: models.py:144
+#: models.py:141
msgid "Closing date"
msgstr ""
-#: models.py:151
+#: models.py:148
msgid "In charge scientist"
msgstr ""
-#: models.py:167 models.py:774
+#: models.py:163 models.py:763
msgid "File"
msgstr ""
-#: models.py:171
+#: models.py:167
msgid "Surface (m2)"
msgstr ""
-#: models.py:224
+#: models.py:220
msgid "Cached name"
msgstr ""
-#: models.py:232
+#: models.py:228
msgid ""
"If checked, it means that this operation have not been officialy registered."
msgstr ""
-#: models.py:244
-msgid "Can view all Operation"
+#: models.py:240
+msgid "Can view all Operations"
msgstr ""
-#: models.py:245
+#: models.py:241
msgid "Can view own Operation"
msgstr ""
-#: models.py:246
+#: models.py:242
msgid "Can add own Operation"
msgstr ""
-#: models.py:247
+#: models.py:243
msgid "Can change own Operation"
msgstr ""
-#: models.py:248
+#: models.py:244
msgid "Can delete own Operation"
msgstr ""
-#: models.py:249
+#: models.py:245
msgid "Can close Operation"
msgstr ""
-#: models.py:272
+#: models.py:268
msgid "OPE"
msgstr ""
-#: models.py:332
+#: models.py:325
msgid "Intercommunal"
msgstr ""
-#: models.py:358 models.py:535
+#: models.py:351 models.py:527
msgid "Archaeological file"
msgstr ""
-#: models.py:359
+#: models.py:352
msgid "Code patriarche"
msgstr ""
-#: models.py:401
+#: models.py:394
msgid "This operation code already exists for this year"
msgstr ""
-#: models.py:467
+#: models.py:459
msgid "Inverse relation"
msgstr ""
-#: models.py:471
+#: models.py:463
msgid "Operation relation type"
msgstr ""
-#: models.py:472
+#: models.py:464
msgid "Operation relation types"
msgstr ""
-#: models.py:485
+#: models.py:477
msgid "Operation record relation"
msgstr ""
-#: models.py:486
+#: models.py:478
msgid "Operation record relations"
msgstr ""
-#: models.py:507
+#: models.py:499
msgid "Operation documentation"
msgstr ""
-#: models.py:508
+#: models.py:500
msgid "Operation documentations"
msgstr ""
-#: models.py:511
-msgid "Can view all Operation source"
+#: models.py:503
+msgid "Can view all Operation sources"
msgstr ""
-#: models.py:513
+#: models.py:505
msgid "Can view own Operation source"
msgstr ""
-#: models.py:515
+#: models.py:507
msgid "Can add own Operation source"
msgstr ""
-#: models.py:517
+#: models.py:509
msgid "Can change own Operation source"
msgstr ""
-#: models.py:519
+#: models.py:511
msgid "Can delete own Operation source"
msgstr ""
-#: models.py:538
+#: models.py:530
msgid "Intended to"
msgstr ""
-#: models.py:540
+#: models.py:532
msgid "Code"
msgstr ""
-#: models.py:543
+#: models.py:535
msgid "Associated template"
msgstr ""
-#: models.py:544
+#: models.py:536
msgid "Indexed"
msgstr ""
-#: models.py:548
+#: models.py:540
msgid "Act types"
msgstr ""
-#: models.py:571
+#: models.py:562
msgid "Person in charge of the operation"
msgstr ""
-#: models.py:577
+#: models.py:568
msgid "Archaeological preventive operator"
msgstr ""
-#: models.py:585
+#: models.py:576
msgid "Signatory"
msgstr ""
-#: models.py:604
+#: models.py:594
msgid "Departments"
msgstr ""
-#: models.py:605
+#: models.py:595
msgid "Cached values get from associated departments"
msgstr ""
-#: models.py:608
+#: models.py:598
msgid "Cached values get from associated towns"
msgstr ""
-#: models.py:615
+#: models.py:605 templates/ishtar/sheet_operation.html:134
msgid "Administrative acts"
msgstr ""
-#: models.py:618
-msgid "Can view all Administrative act"
+#: models.py:608
+msgid "Can view all Administrative acts"
msgstr ""
-#: models.py:620
+#: models.py:610
msgid "Can view own Administrative act"
msgstr ""
-#: models.py:622
+#: models.py:612
msgid "Can add own Administrative act"
msgstr ""
-#: models.py:624
+#: models.py:614
msgid "Can change own Administrative act"
msgstr ""
-#: models.py:626
+#: models.py:616
msgid "Can delete own Administrative act"
msgstr ""
-#: models.py:635
+#: models.py:625
#: templates/ishtar/blocks/window_tables/administrativacts.html:5
+#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:5
msgid "Ref."
msgstr ""
-#: models.py:718
+#: models.py:708
msgid "This index already exists for this year"
msgstr ""
-#: models.py:785
+#: models.py:774
msgid "External ID"
msgstr ""
-#: models.py:787
+#: models.py:776
msgid "Address - Locality"
msgstr ""
-#: models.py:947
+#: models.py:934
msgid "Owner"
msgstr ""
-#: models.py:955
+#: models.py:942
msgid "Parcel owner"
msgstr ""
-#: models.py:956
+#: models.py:943
msgid "Parcel owners"
msgstr ""
-#: models.py:982
+#: models.py:969
msgid "Recorded"
msgstr ""
-#: models.py:983
+#: models.py:970
msgid "Effective"
msgstr ""
-#: models.py:984
+#: models.py:971
msgid "Active"
msgstr ""
-#: models.py:985
+#: models.py:972
msgid "Field completed"
msgstr ""
-#: models.py:986
+#: models.py:973
msgid "Associated report"
msgstr ""
-#: models.py:987
+#: models.py:974
msgid "Closed"
msgstr ""
-#: models.py:988
+#: models.py:975
msgid "Documented and closed"
msgstr ""
-#: models.py:1414
+#: models.py:1401
msgid "Is preventive"
msgstr ""
-#: models.py:1417
+#: models.py:1404
msgid "Operation type old"
msgstr ""
-#: models.py:1418
+#: models.py:1405
msgid "Operation types old"
msgstr ""
-#: views.py:252
+#: views.py:258
msgid "New operation"
msgstr ""
-#: views.py:287
+#: views.py:294
msgid "Operation modification"
msgstr ""
-#: views.py:327
+#: views.py:334
msgid "Operation closing"
msgstr ""
-#: views.py:333
+#: views.py:340
msgid "Operation deletion"
msgstr ""
-#: views.py:338
+#: views.py:345
msgid "Operation: source search"
msgstr ""
-#: views.py:346
+#: views.py:353
msgid "Operation: source creation"
msgstr ""
-#: views.py:354
+#: views.py:361
msgid "Operation: source modification"
msgstr ""
-#: views.py:360
+#: views.py:367
msgid "Operation: source deletion"
msgstr ""
-#: views.py:375
+#: views.py:382
msgid "Operation: new administrative act"
msgstr ""
-#: views.py:385
+#: views.py:392
msgid "Operation: administrative act modification"
msgstr ""
-#: views.py:394
+#: views.py:401
msgid "Operation: administrative act deletion"
msgstr ""
-#: wizards.py:203
+#: wizards.py:199
msgid ""
"Warning: No Archaelogical File is provided. If you have forget it return to "
"the first step."
@@ -1069,47 +1074,43 @@ msgstr ""
msgid "Permit reference:"
msgstr ""
-#: templates/ishtar/sheet_operation.html:99
+#: templates/ishtar/sheet_operation.html:100
msgid "Localisation"
msgstr ""
-#: templates/ishtar/sheet_operation.html:100
+#: templates/ishtar/sheet_operation.html:101
msgid "Towns:"
msgstr ""
-#: templates/ishtar/sheet_operation.html:102
+#: templates/ishtar/sheet_operation.html:104
msgid "Main address:"
msgstr ""
-#: templates/ishtar/sheet_operation.html:103
+#: templates/ishtar/sheet_operation.html:105
msgid "Complement:"
msgstr ""
-#: templates/ishtar/sheet_operation.html:104
+#: templates/ishtar/sheet_operation.html:106
msgid "Postal code:"
msgstr ""
-#: templates/ishtar/sheet_operation.html:118
+#: templates/ishtar/sheet_operation.html:120
msgid "Details"
msgstr ""
-#: templates/ishtar/sheet_operation.html:123
+#: templates/ishtar/sheet_operation.html:130
msgid "Associated parcels"
msgstr ""
-#: templates/ishtar/sheet_operation.html:127
-msgid "Administrativ acts"
-msgstr ""
-
-#: templates/ishtar/sheet_operation.html:131
+#: templates/ishtar/sheet_operation.html:138
msgid "Document from this operation"
msgstr ""
-#: templates/ishtar/sheet_operation.html:136
+#: templates/ishtar/sheet_operation.html:143
msgid "Context records"
msgstr ""
-#: templates/ishtar/sheet_operation.html:148
+#: templates/ishtar/sheet_operation.html:155
msgid "Finds"
msgstr ""
@@ -1130,6 +1131,10 @@ msgstr ""
msgid "No administrative act associated"
msgstr ""
+#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:18
+msgid "No archaeological site associated"
+msgstr ""
+
#: templates/ishtar/blocks/window_tables/parcels.html:20
msgid "No parcel"
msgstr ""
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 448adcd68..945af21a4 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -35,8 +35,6 @@ from ishtar_common.models import GeneralType, BaseHistorizedItem, \
Person, Organization, Town, Dashboard, IshtarUser, ValueGetter, \
DocumentTemplate, ShortMenuItem, DashboardFormItem, GeneralRelationType,\
GeneralRecordRelations, post_delete_record_relation, OperationType
-FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
-FINDS_AVAILABLE = 'archaeological_finds' in settings.INSTALLED_APPS
class RemainType(GeneralType):
@@ -88,7 +86,7 @@ class ArchaeologicalSite(BaseHistorizedItem):
verbose_name_plural = _(u"Archaeological sites")
permissions = (
("view_archaeologicalsite",
- ugettext(u"Can view all Archaeological site")),
+ ugettext(u"Can view all Archaeological sites")),
("view_own_archaeologicalsite",
ugettext(u"Can view own Archaeological site")),
("add_own_archaeologicalsite",
@@ -137,8 +135,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
SHOW_URL = 'show-operation'
TABLE_COLS = ['year_index', 'operation_type', 'remains', 'towns',
'start_date', 'excavation_end_date']
- if FILES_AVAILABLE:
- TABLE_COLS.insert(4, 'associated_file_short_label')
+ TABLE_COLS.insert(4, 'associated_file_short_label')
creation_date = models.DateField(_(u"Creation date"),
default=datetime.date.today)
end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
@@ -161,11 +158,10 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
year = models.IntegerField(_(u"Year"), null=True, blank=True)
operation_code = models.IntegerField(_(u"Operation code"), null=True,
blank=True)
- if FILES_AVAILABLE:
- associated_file = models.ForeignKey(
- 'archaeological_files.File',
- related_name='operations', verbose_name=_(u"File"),
- blank=True, null=True)
+ associated_file = models.ForeignKey(
+ 'archaeological_files.File',
+ related_name='operations', verbose_name=_(u"File"),
+ blank=True, null=True)
operation_type = models.ForeignKey(OperationType, related_name='+',
verbose_name=_(u"Operation type"))
surface = models.IntegerField(_(u"Surface (m2)"), blank=True, null=True)
@@ -241,7 +237,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
verbose_name = _(u"Operation")
verbose_name_plural = _(u"Operations")
permissions = (
- ("view_operation", ugettext(u"Can view all Operation")),
+ ("view_operation", ugettext(u"Can view all Operations")),
("view_own_operation", ugettext(u"Can view own Operation")),
("add_own_operation", ugettext(u"Can add own Operation")),
("change_own_operation", ugettext(u"Can change own Operation")),
@@ -286,15 +282,12 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
return reverse('show-operation', args=[self.pk, ''])
def has_finds(self):
- if not FINDS_AVAILABLE:
- return
from archaeological_finds.models import BaseFind
return BaseFind.objects.filter(context_record__operation=self).count()
def finds(self):
- if FINDS_AVAILABLE:
- from archaeological_finds.models import BaseFind
- return BaseFind.objects.filter(context_record__operation=self)
+ from archaeological_finds.models import BaseFind
+ return BaseFind.objects.filter(context_record__operation=self)
def get_reference(self, full=False):
ref = ""
@@ -360,7 +353,7 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
@property
def associated_file_short_label(self):
- if not FILES_AVAILABLE or not self.associated_file:
+ if not self.associated_file:
return ""
return self.associated_file.short_label
@@ -453,10 +446,9 @@ def operation_post_save(sender, **kwargs):
operation.fnap_financing = fnap_percent
operation.save()
cached_label_changed(sender, **kwargs)
- if FILES_AVAILABLE and operation.associated_file:
+ if operation.associated_file:
operation.associated_file.update_short_menu_class()
- # manage parcel association
- if FILES_AVAILABLE and operation.associated_file:
+ # manage parcel association
for parcel in operation.parcels.all():
parcel.copy_to_file()
post_save.connect(operation_post_save, sender=Operation)
@@ -508,7 +500,7 @@ class OperationSource(Source):
verbose_name_plural = _(u"Operation documentations")
permissions = (
("view_operationsource",
- ugettext(u"Can view all Operation source")),
+ ugettext(u"Can view all Operation sources")),
("view_own_operationsource",
ugettext(u"Can view own Operation source")),
("add_own_operationsource",
@@ -548,216 +540,214 @@ class ActType(GeneralType):
verbose_name_plural = _(u"Act types")
ordering = ('label',)
-AdministrativeAct = None
-if FILES_AVAILABLE:
- class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
- TABLE_COLS = ['full_ref', 'year', 'index', 'act_type', 'act_object',
- 'signature_date', 'associated_file', 'operation',
- 'towns_label']
- TABLE_COLS_FILE = [
- 'full_ref', 'year', 'index', 'act_type',
- 'act_object', 'associated_file', 'towns_label',
- ]
- TABLE_COLS_OPE = ['full_ref', 'year', 'index', 'act_type', 'operation',
- 'act_object', 'towns_label']
- if settings.COUNTRY == 'fr':
- TABLE_COLS.append('departments_label')
- TABLE_COLS_FILE.append('departments_label')
- TABLE_COLS_OPE.append('departments_label')
- act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type"))
- in_charge = models.ForeignKey(
- Person, blank=True, null=True,
- related_name='adminact_operation_in_charge',
- verbose_name=_(u"Person in charge of the operation"),
- on_delete=models.SET_NULL,)
- index = models.IntegerField(verbose_name=_(u"Index"), blank=True,
- null=True)
- operator = models.ForeignKey(
- Organization, blank=True, null=True,
- verbose_name=_(u"Archaeological preventive operator"),
- related_name='adminact_operator', on_delete=models.SET_NULL)
- scientist = models.ForeignKey(
- Person, blank=True, null=True,
- related_name='adminact_scientist', on_delete=models.SET_NULL,
- verbose_name=_(u"Scientist in charge"))
- signatory = models.ForeignKey(
- Person, blank=True, null=True, related_name='signatory',
- verbose_name=_(u"Signatory"), on_delete=models.SET_NULL,)
- operation = models.ForeignKey(
- Operation, blank=True, null=True,
- related_name='administrative_act', verbose_name=_(u"Operation"))
- if FILES_AVAILABLE:
- associated_file = models.ForeignKey(
- 'archaeological_files.File',
- blank=True, null=True,
- related_name='administrative_act',
- verbose_name=_(u"Archaelogical file"))
- signature_date = models.DateField(_(u"Signature date"), blank=True,
- null=True)
- year = models.IntegerField(_(u"Year"), blank=True, null=True)
- act_object = models.TextField(_(u"Object"), max_length=300, blank=True,
+
+class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
+ TABLE_COLS = ['full_ref', 'year', 'index', 'act_type', 'act_object',
+ 'signature_date', 'associated_file', 'operation',
+ 'towns_label']
+ TABLE_COLS_FILE = [
+ 'full_ref', 'year', 'index', 'act_type',
+ 'act_object', 'associated_file', 'towns_label',
+ ]
+ TABLE_COLS_OPE = ['full_ref', 'year', 'index', 'act_type', 'operation',
+ 'act_object', 'towns_label']
+ if settings.COUNTRY == 'fr':
+ TABLE_COLS.append('departments_label')
+ TABLE_COLS_FILE.append('departments_label')
+ TABLE_COLS_OPE.append('departments_label')
+ act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type"))
+ in_charge = models.ForeignKey(
+ Person, blank=True, null=True,
+ related_name='adminact_operation_in_charge',
+ verbose_name=_(u"Person in charge of the operation"),
+ on_delete=models.SET_NULL,)
+ index = models.IntegerField(verbose_name=_(u"Index"), blank=True,
+ null=True)
+ operator = models.ForeignKey(
+ Organization, blank=True, null=True,
+ verbose_name=_(u"Archaeological preventive operator"),
+ related_name='adminact_operator', on_delete=models.SET_NULL)
+ scientist = models.ForeignKey(
+ Person, blank=True, null=True,
+ related_name='adminact_scientist', on_delete=models.SET_NULL,
+ verbose_name=_(u"Scientist in charge"))
+ signatory = models.ForeignKey(
+ Person, blank=True, null=True, related_name='signatory',
+ verbose_name=_(u"Signatory"), on_delete=models.SET_NULL,)
+ operation = models.ForeignKey(
+ Operation, blank=True, null=True,
+ related_name='administrative_act', verbose_name=_(u"Operation"))
+ associated_file = models.ForeignKey(
+ 'archaeological_files.File',
+ blank=True, null=True,
+ related_name='administrative_act',
+ verbose_name=_(u"Archaelogical file"))
+ signature_date = models.DateField(_(u"Signature date"), blank=True,
null=True)
- if settings.COUNTRY == 'fr':
- ref_sra = models.CharField(u"Référence SRA", max_length=15,
- blank=True, null=True)
- departments_label = models.TextField(
- _(u"Departments"), blank=True, null=True,
- help_text=_(u"Cached values get from associated departments"))
- towns_label = models.TextField(
- _(u"Towns"), blank=True, null=True,
- help_text=_(u"Cached values get from associated towns"))
- history = HistoricalRecords()
- _prefix = 'adminact_'
-
- class Meta:
- ordering = ('year', 'signature_date', 'index', 'act_type')
- verbose_name = _(u"Administrative act")
- verbose_name_plural = _(u"Administrative acts")
- permissions = (
- ("view_administrativeact",
- ugettext(u"Can view all Administrative act")),
- ("view_own_administrativeact",
- ugettext(u"Can view own Administrative act")),
- ("add_own_administrativeact",
- ugettext(u"Can add own Administrative act")),
- ("change_own_administrativeact",
- ugettext(u"Can change own Administrative act")),
- ("delete_own_administrativeact",
- ugettext(u"Can delete own Administrative act")),
- )
+ year = models.IntegerField(_(u"Year"), blank=True, null=True)
+ act_object = models.TextField(_(u"Object"), max_length=300, blank=True,
+ null=True)
+ if settings.COUNTRY == 'fr':
+ ref_sra = models.CharField(u"Référence SRA", max_length=15,
+ blank=True, null=True)
+ departments_label = models.TextField(
+ _(u"Departments"), blank=True, null=True,
+ help_text=_(u"Cached values get from associated departments"))
+ towns_label = models.TextField(
+ _(u"Towns"), blank=True, null=True,
+ help_text=_(u"Cached values get from associated towns"))
+ history = HistoricalRecords()
+ _prefix = 'adminact_'
+
+ class Meta:
+ ordering = ('year', 'signature_date', 'index', 'act_type')
+ verbose_name = _(u"Administrative act")
+ verbose_name_plural = _(u"Administrative acts")
+ permissions = (
+ ("view_administrativeact",
+ ugettext(u"Can view all Administrative acts")),
+ ("view_own_administrativeact",
+ ugettext(u"Can view own Administrative act")),
+ ("add_own_administrativeact",
+ ugettext(u"Can add own Administrative act")),
+ ("change_own_administrativeact",
+ ugettext(u"Can change own Administrative act")),
+ ("delete_own_administrativeact",
+ ugettext(u"Can delete own Administrative act")),
+ )
+
+ def __unicode__(self):
+ return settings.JOINT.join(
+ [unicode(item) for item in [
+ self.operation, self.associated_file, self.act_object]
+ if item])
- def __unicode__(self):
- return settings.JOINT.join(
- [unicode(item) for item in [
- self.operation, self.associated_file, self.act_object]
- if item])
-
- full_ref_lbl = _(u"Ref.")
-
- @property
- def full_ref(self):
- lbl = []
- if self.year:
- lbl.append(unicode(self.year))
- if self.index:
- lbl.append(u"n°%d" % self.index)
- if settings.COUNTRY == 'fr' and self.ref_sra:
- lbl.append(u"[%s]" % self.ref_sra)
- return u" ".join(lbl)
-
- @property
- def towns(self):
- if self.associated_file:
- return self.associated_file.towns.all()
- elif self.operation:
- return self.operation.towns.all()
- return []
-
- @property
- def departments(self):
- if settings.COUNTRY != 'fr':
- return ''
- q = None
- if self.associated_file:
- q = self.associated_file.towns.all()
- elif self.operation:
- q = self.operation.towns.all()
- if not q:
- return ''
- dpts = []
- for town in q:
- dpt = town.numero_insee[:2]
- if dpt not in dpts:
- dpts.append(dpt)
- return ', '.join(list(sorted(dpts)))
-
- @property
- def related_item(self):
- return self.operation if self.operation else self.associated_file
-
- def get_filename(self):
- filename = self.related_item.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 and self.index:
- filename += u"-%d-%d" % (self.signature_date.year,
- self.index)
- if self.signature_date:
- filename += u"-" + self.signature_date.strftime('%Y%m%d')
- return filename
-
- def publish(self, template_pk=None):
- if not self.act_type.associated_template.count():
+ full_ref_lbl = _(u"Ref.")
+
+ @property
+ def full_ref(self):
+ lbl = []
+ if self.year:
+ lbl.append(unicode(self.year))
+ if self.index:
+ lbl.append(u"n°%d" % self.index)
+ if settings.COUNTRY == 'fr' and self.ref_sra:
+ lbl.append(u"[%s]" % self.ref_sra)
+ return u" ".join(lbl)
+
+ @property
+ def towns(self):
+ if self.associated_file:
+ return self.associated_file.towns.all()
+ elif self.operation:
+ return self.operation.towns.all()
+ return []
+
+ @property
+ def departments(self):
+ if settings.COUNTRY != 'fr':
+ return ''
+ q = None
+ if self.associated_file:
+ q = self.associated_file.towns.all()
+ elif self.operation:
+ q = self.operation.towns.all()
+ if not q:
+ return ''
+ dpts = []
+ for town in q:
+ dpt = town.numero_insee[:2]
+ if dpt not in dpts:
+ dpts.append(dpt)
+ return ', '.join(list(sorted(dpts)))
+
+ @property
+ def related_item(self):
+ return self.operation if self.operation else self.associated_file
+
+ def get_filename(self):
+ filename = self.related_item.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 and self.index:
+ filename += u"-%d-%d" % (self.signature_date.year,
+ self.index)
+ if self.signature_date:
+ filename += u"-" + self.signature_date.strftime('%Y%m%d')
+ return filename
+
+ def publish(self, template_pk=None):
+ if not self.act_type.associated_template.count():
+ return
+ if not template_pk:
+ template = self.act_type.associated_template.all()[0]
+ else:
+ q = self.act_type.associated_template.filter(pk=template_pk)
+ if not q.count():
return
- if not template_pk:
- template = self.act_type.associated_template.all()[0]
- else:
- q = self.act_type.associated_template.filter(pk=template_pk)
- if not q.count():
- return
- template = q.all()[0]
- return template.publish(self)
-
- def _get_index(self):
- if not self.index:
- c_index = 1
- q = AdministrativeAct.objects.filter(
- act_type__indexed=True, signature_date__year=self.year,
- index__isnull=False).order_by("-index")
- if q.count():
- c_index = q.all()[0].index + 1
- self.index = c_index
- conflict = AdministrativeAct.objects.filter(
+ template = q.all()[0]
+ return template.publish(self)
+
+ def _get_index(self):
+ if not self.index:
+ c_index = 1
+ q = AdministrativeAct.objects.filter(
act_type__indexed=True, signature_date__year=self.year,
- index=self.index)
+ index__isnull=False).order_by("-index")
+ if q.count():
+ c_index = q.all()[0].index + 1
+ self.index = c_index
+ conflict = AdministrativeAct.objects.filter(
+ act_type__indexed=True, signature_date__year=self.year,
+ index=self.index)
+ if self.pk:
+ conflict = conflict.exclude(pk=self.pk)
+ if conflict.count():
if self.pk:
- conflict = conflict.exclude(pk=self.pk)
- if conflict.count():
- if self.pk:
- raise ValidationError(_(u"This index already exists for "
- u"this year"))
- else:
- self._get_index()
-
- def clean(self, *args, **kwargs):
- if not self.signature_date:
- return super(AdministrativeAct, self).clean(*args, **kwargs)
- self.year = self.signature_date.year
- if not self.act_type.indexed:
- return super(AdministrativeAct, self).clean(*args, **kwargs)
- self._get_index()
- super(AdministrativeAct, self).clean(*args, **kwargs)
+ raise ValidationError(_(u"This index already exists for "
+ u"this year"))
+ else:
+ self._get_index()
+
+ def clean(self, *args, **kwargs):
+ if not self.signature_date:
+ return super(AdministrativeAct, self).clean(*args, **kwargs)
+ self.year = self.signature_date.year
+ if not self.act_type.indexed:
+ return super(AdministrativeAct, self).clean(*args, **kwargs)
+ self._get_index()
+ super(AdministrativeAct, self).clean(*args, **kwargs)
- def save(self, *args, **kwargs):
- if settings.COUNTRY == 'fr':
- self.departments_label = self.departments
- self.towns_label = u", ".join(
- list(sorted([unicode(town) for town in self.towns])))
+ def save(self, *args, **kwargs):
+ if settings.COUNTRY == 'fr':
+ self.departments_label = self.departments
+ self.towns_label = u", ".join(
+ list(sorted([unicode(town) for town in self.towns])))
- force = False
- if 'force' in kwargs:
- force = kwargs.pop('force')
+ force = False
+ if 'force' in kwargs:
+ force = kwargs.pop('force')
- if not self.signature_date:
- return super(AdministrativeAct, self).save(*args, **kwargs)
- self.year = self.signature_date.year
+ if not self.signature_date:
+ return super(AdministrativeAct, self).save(*args, **kwargs)
+ self.year = self.signature_date.year
- if not self.act_type.indexed:
- return super(AdministrativeAct, self).save(*args, **kwargs)
+ if not self.act_type.indexed:
+ return super(AdministrativeAct, self).save(*args, **kwargs)
- if not force:
+ if not force:
+ self._get_index()
+ else:
+ try:
self._get_index()
- else:
- try:
- self._get_index()
- except:
- pass
+ except:
+ pass
- super(AdministrativeAct, self).save(*args, **kwargs)
- if hasattr(self, 'associated_file') and self.associated_file:
- self.associated_file.update_has_admin_act()
- self.associated_file.update_short_menu_class()
+ super(AdministrativeAct, self).save(*args, **kwargs)
+ if hasattr(self, 'associated_file') and self.associated_file:
+ self.associated_file.update_has_admin_act()
+ self.associated_file.update_short_menu_class()
def strip_zero(value):
@@ -768,11 +758,10 @@ def strip_zero(value):
class Parcel(LightHistorizedItem):
- if FILES_AVAILABLE:
- associated_file = models.ForeignKey(
- 'archaeological_files.File',
- related_name='parcels', verbose_name=_(u"File"),
- blank=True, null=True)
+ associated_file = models.ForeignKey(
+ 'archaeological_files.File',
+ related_name='parcels', verbose_name=_(u"File"),
+ blank=True, null=True)
operation = models.ForeignKey(
Operation, related_name='parcels', blank=True, null=True,
verbose_name=_(u"Operation"))
@@ -867,7 +856,7 @@ class Parcel(LightHistorizedItem):
def long_label(self):
items = [unicode(self.operation) or
- (FILES_AVAILABLE and unicode(self.associated_file)) or ""]
+ unicode(self.associated_file) or ""]
items += [unicode(item) for item in [self.section, self.parcel_number]
if item]
return settings.JOINT.join(items)
@@ -931,12 +920,10 @@ def parcel_post_save(sender, **kwargs):
if parcel.operation and parcel.operation.pk and \
parcel.town not in list(parcel.operation.towns.all()):
parcel.operation.towns.add(parcel.town)
- if FILES_AVAILABLE and parcel.associated_file and \
+ if parcel.associated_file and \
parcel.associated_file.pk and \
parcel.town not in list(parcel.associated_file.towns.all()):
parcel.associated_file.towns.add(parcel.town)
- if not FILES_AVAILABLE:
- return
if parcel.operation and parcel.associated_file:
# parcels are copied between files and operations
parcel.copy_to_operation()
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html
new file mode 100644
index 000000000..d72291c5b
--- /dev/null
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html
@@ -0,0 +1,20 @@
+{% load i18n %}
+<table class='simple'>
+ <caption>{{caption}}</caption>
+ <tr>
+ <th>{% trans "Ref." %}</th>
+ <th>{% trans "Name" %}</th>
+ <th>{% trans "Periods" %}</th>
+ <th>{% trans "Remains" %}</th>
+ </tr>
+ {% for archaeosite in data %}
+ <tr>
+ <td class='string'>{{archaeosite.reference}}</td>
+ <td class='string'>{{archaeosite.name}}</td>
+ <td class='string'>{% for period in archaeosite.periods.all %}{{period}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
+ <td class='string'>{% for remain in archaeosite.remains.all %}{{remain}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
+ </tr>
+ {% empty %}
+ <tr><td colspan="4" class='no_items'>{% trans "No archaeological site associated" %}</td></tr>
+ {% endfor %}
+</table>
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index c45d6eb73..14210046b 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -96,8 +96,10 @@
{% field "Comment" item.comment "<pre>" "</pre>" %}
+{% if item.towns.count %}
<h3>{% trans "Localisation"%}</h3>
<p><label>{%trans "Towns:"%}</label> <span class='value'>{{ item.towns.all|join:", " }}</span></p>
+{% endif %}
{% if item.associated_file.address %}<p><label>{%trans "Main address:"%}</label> <span class='value'>{{ item.associated_file.address }}</span></p>
{% if item.associated_file.address_complement %}<p><label>{%trans "Complement:"%}</label> <span class='value'>{{ item.associated_file.address_complement }}</span></p>{%endif%}
@@ -120,34 +122,39 @@
{% endfor %}
{% endif %}
+{% if item.archaeological_sites.count %}
+{% trans "Archaeological sites" as archaeologicalsites_label %}
+{% table_archaeologicalsites archaeologicalsites_label item.archaeological_sites.all %}
+{% endif %}
+
{% trans "Associated parcels" as parcels_label %}
{% include "ishtar/blocks/window_tables/parcels.html" %}
{% if item.administrative_act %}
-{% trans "Administrativ acts" as administrativeacts_label %}
+{% trans "Administrative acts" as administrativeacts_label %}
{% table_administrativact administrativeacts_label item.administrative_act.all %}
{% endif %}
{% trans "Document from this operation" as operation_docs %}
{% if item.source.count %}
-{% dynamic_table_document operation_docs 'operation_docs' 'operation' item.pk %}
+{% dynamic_table_document operation_docs 'operation_docs' 'operation' item.pk '' output %}
{% endif %}
{% trans "Context records" as context_records %}
{% if item.context_record.count %}
-{% dynamic_table_document context_records 'context_records_for_ope' 'operation' item.pk 'TABLE_COLS_FOR_OPE' %}
+{% dynamic_table_document context_records 'context_records_for_ope' 'operation' item.pk 'TABLE_COLS_FOR_OPE' output %}
{% endif %}
{% comment %}
{% trans "Documents from associated context records" as cr_docs %}
{% if item.context_record_docs_q.count %}
-{% dynamic_table_document cr_docs 'context_records_docs' 'context_record__operation' item.pk %}
+{% dynamic_table_document cr_docs 'context_records_docs' 'context_record__operation' item.pk '' output %}
{% endif %}
{% endcomment %}
{% trans "Finds" as finds %}
{% if item.finds %}
-{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record__operation' item.pk 'TABLE_COLS_FOR_OPE' %}
+{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record__operation' item.pk 'TABLE_COLS_FOR_OPE' output %}
{% endif %}
{% comment %}
diff --git a/archaeological_operations/templatetags/window_ope_tables.py b/archaeological_operations/templatetags/window_ope_tables.py
index 5576fe32d..ca263832f 100644
--- a/archaeological_operations/templatetags/window_ope_tables.py
+++ b/archaeological_operations/templatetags/window_ope_tables.py
@@ -1,10 +1,13 @@
from django import template
-from django.utils.translation import ugettext as _
-import re
register = template.Library()
+
@register.inclusion_tag('ishtar/blocks/window_tables/administrativacts.html')
def table_administrativact(caption, data):
- return {'caption':caption, 'data':data}
+ return {'caption': caption, 'data': data}
+
+@register.inclusion_tag('ishtar/blocks/window_tables/archaeologicalsites.html')
+def table_archaeologicalsites(caption, data):
+ return {'caption': caption, 'data': data}
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 5299b7131..0b9b9c453 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -30,6 +30,7 @@ from ishtar_common.wizards import SearchWizard, check_rights_condition
from ishtar_common.forms import ClosingDateFormSelection
from ishtar_common.forms_common import AuthorFormset, TownFormset, \
SourceDeletionForm
+from ishtar_common.models import get_current_profile
from wizards import *
from forms import *
import models
@@ -231,7 +232,9 @@ operation_search_wizard = SearchWizard.as_view([
url_name='operation_search',)
wizard_steps = [
+ ('filechoice-operation_creation', OperationFormFileChoice),
('general-operation_creation', OperationFormGeneral),
+ ('archaeologicalsite-operation_creation', ArchaeologicalSiteFormSet),
('preventive-operation_creation', OperationFormPreventive),
('preventivediag-operation_creation', OperationFormPreventiveDiag),
('townsgeneral-operation_creation', TownFormset),
@@ -243,16 +246,19 @@ wizard_steps = [
('relations-operation_creation', RecordRelationsFormSet),
('abstract-operation_creation', OperationFormAbstract),
('final-operation_creation', FinalForm)]
-if FILES_AVAILABLE:
- wizard_steps.insert(0, ('filechoice-operation_creation',
- OperationFormFileChoice))
+
+
+def check_files_for_operation(self):
+ if not check_rights_condition(['view_file'])(self):
+ return False
+ return get_current_profile().files
operation_creation_wizard = OperationWizard.as_view(
wizard_steps,
label=_(u"New operation"),
condition_dict={
'filechoice-operation_creation':
- check_rights_condition(['view_file']),
+ check_files_for_operation,
'preventive-operation_creation':
is_preventive('general-operation_creation', models.OperationType,
'operation_type', 'prev_excavation'),
@@ -273,6 +279,7 @@ operation_creation_wizard = OperationWizard.as_view(
operation_modification_wizard = OperationModificationWizard.as_view([
('selec-operation_modification', OperationFormSelection),
('general-operation_modification', OperationFormModifGeneral),
+ ('archaeologicalsite-operation_modification', ArchaeologicalSiteFormSet),
('preventive-operation_modification', OperationFormPreventive),
('preventivediag-operation_modification', OperationFormPreventiveDiag),
('towns-operation_modification', SelectedTownFormset),
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index 6e512e826..c90b6fa8a 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -31,9 +31,7 @@ from ishtar_common.wizards import Wizard, ClosingWizard, DeletionWizard, \
import models
from forms import GenerateDocForm
-FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
-if FILES_AVAILABLE:
- from archaeological_files.models import File
+from archaeological_files.models import File
class OperationWizard(Wizard):
@@ -59,7 +57,7 @@ class OperationWizard(Wizard):
def get_current_file(self):
step = self.steps.current
- if not FILES_AVAILABLE or not step:
+ if not step:
return
file_form_key = 'general-' + self.url_name
if self.url_name == 'operation_creation':
@@ -104,8 +102,6 @@ class OperationWizard(Wizard):
"""
Get available towns
"""
- if not FILES_AVAILABLE:
- return -1
towns = []
file = self.get_current_file()
if not file: