summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-21 18:29:47 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-21 18:29:47 +0200
commit92c84e043c6e788190980883265e50ed8a1fa5a1 (patch)
tree606b2c5299a5376e49addc4e2f8acc5d5f465fbe /archaeological_operations
parent0f0d096915e95b879b4c027d02e9e28e1279fa3d (diff)
downloadIshtar-92c84e043c6e788190980883265e50ed8a1fa5a1.tar.bz2
Ishtar-92c84e043c6e788190980883265e50ed8a1fa5a1.zip
Djangoization - Major refactoring (step 9)
* move templates * change labels
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/views.py53
-rw-r--r--archaeological_operations/wizards.py9
2 files changed, 38 insertions, 24 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 7866e2c66..c00624fe1 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -96,6 +96,7 @@ def dashboard_operation(request, dct, obj_id=None, *args, **kwargs):
operation_search_wizard = SearchWizard.as_view([
('general-operation_search', OperationFormSelection)],
+ label=_(u"Operation search"),
url_name='operation_search',)
operation_creation_wizard = OperationWizard.as_view([
@@ -109,19 +110,26 @@ operation_creation_wizard = OperationWizard.as_view([
('remains-operation_creation', RemainFormset),
('periods-operation_creation', PeriodFormset),
('final-operation_creation', FinalForm)],
- condition_dict={
-'preventive-operation_creation':is_preventive('general-operation_creation',
- models.OperationType, 'operation_type', 'prev_excavation'),
-'preventivediag-operation_creation':is_preventive('general-operation_creation',
- models.OperationType, 'operation_type', 'arch_diagnostic'),
-'townsgeneral-operation_creation':has_associated_file(
+ label=_(u"Operation creation"),
+ condition_dict={
+ 'preventive-operation_creation':\
+ is_preventive('general-operation_creation',
+ models.OperationType,
+ 'operation_type', 'prev_excavation'),
+ 'preventivediag-operation_creation':\
+ is_preventive('general-operation_creation',
+ models.OperationType,
+ 'operation_type', 'arch_diagnostic'),
+ 'townsgeneral-operation_creation':has_associated_file(
'general-operation_creation', negate=True),
-'towns-operation_creation':has_associated_file('general-operation_creation'),
-'parcelsgeneral-operation_creation':has_associated_file(
+ 'towns-operation_creation':has_associated_file(
+ 'general-operation_creation'),
+ 'parcelsgeneral-operation_creation':has_associated_file(
'general-operation_creation', negate=True),
-'parcels-operation_creation':has_associated_file('general-operation_creation'),
+ 'parcels-operation_creation':has_associated_file(
+ 'general-operation_creation'),
},
- url_name='operation_creation',)
+ url_name='operation_creation',)
operation_modification_wizard = OperationModificationWizard.as_view([
('selec-operation_modification', OperationFormSelection),
@@ -135,33 +143,36 @@ operation_modification_wizard = OperationModificationWizard.as_view([
('remains-operation_modification', RemainFormset),
('periods-operation_modification', PeriodFormset),
('final-operation_modification', FinalForm)],
- condition_dict={
-'preventive-operation_modification':is_preventive(
+ label=_(u"Operation modification"),
+ condition_dict={
+ 'preventive-operation_modification':is_preventive(
'general-operation_modification', models.OperationType,
'operation_type', 'prev_excavation'),
-'preventivediag-operation_modification':is_preventive(
+ 'preventivediag-operation_modification':is_preventive(
'general-operation_modification', models.OperationType,
'operation_type', 'arch_diagnostic'),
-'townsgeneral-operation_modification':has_associated_file(
+ 'townsgeneral-operation_modification':has_associated_file(
'general-operation_modification', negate=True),
-'towns-operation_modification':has_associated_file(
+ 'towns-operation_modification':has_associated_file(
'general-operation_modification'),
-'parcelsgeneral-operation_modification':has_associated_file(
+ 'parcelsgeneral-operation_modification':has_associated_file(
'general-operation_modification', negate=True),
-'parcels-operation_modification':has_associated_file(
+ 'parcels-operation_modification':has_associated_file(
'general-operation_modification'),
},
- url_name='operation_modification',)
+ url_name='operation_modification',)
operation_closing_wizard = OperationClosingWizard.as_view([
('selec-operation_closing', OperationFormSelection),
('date-operation_closing', ClosingDateFormSelection),
('final-operation_closing', FinalOperationClosingForm)],
+ label=_(u"Operation closing"),
url_name='operation_closing',)
operation_deletion_wizard = OperationDeletionWizard.as_view([
('selec-operation_deletion', OperationFormSelection),
('final-operation_deletion', OperationDeletionForm)],
+ label=_(u"Operation deletion"),
url_name='operation_deletion',)
operation_source_creation_wizard = OperationSourceWizard.as_view([
@@ -169,18 +180,21 @@ operation_source_creation_wizard = OperationSourceWizard.as_view([
('source-operation_source_creation',OperationSourceForm),
('authors-operation_source_creation', AuthorFormset),
('final-operation_source_creation', FinalForm)],
- url_name='operation_source_creation',)
+ label=_(u"Operation: source creation"),
+ url_name='operation_source_creation',)
operation_source_modification_wizard = OperationSourceWizard.as_view([
('selec-operation_source_modification', OperationSourceFormSelection),
('source-operation_source_modification', OperationSourceForm),
('authors-operation_source_modification', AuthorFormset),
('final-operation_source_modification', FinalForm)],
+ label=_(u"Operation: source modification"),
url_name='operation_source_modification',)
operation_source_deletion_wizard = OperationSourceDeletionWizard.as_view([
('selec-operation_source_deletion', OperationSourceFormSelection),
('final-operation_source_deletion', SourceDeletionForm)],
+ label=_(u"Operation: source deletion"),
url_name='operation_source_deletion',)
operation_administrativeactop_wizard = \
@@ -188,6 +202,7 @@ operation_administrativeactop_wizard = \
('selec-operation_administrativeactop', OperationFormSelection),
('administrativeact-operation_administrativeactop', AdministrativeActOpeForm),
('final-operation_administrativeactop', FinalForm)],
+ label=_(u"Operation: new administrative act"),
url_name='operation_administrativeactop',)
operation_administrativeactop_modification_wizard = \
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index 2dae72aad..7c09c1154 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -33,8 +33,7 @@ class OperationWizard(Wizard):
def get_template_names(self):
templates = super(OperationWizard, self).get_template_names()
- current_step = storage.get_current_step() or self.get_first_step(
- request, storage)
+ current_step = self.steps. current
if current_step.startswith('towns-'):
# vérifier que le context_data est bien chargé
#templates = ['ishtar/wizard/towns_wizard.html'] + templates
@@ -45,7 +44,7 @@ class OperationWizard(Wizard):
"""
Return extra context for templates
"""
- context = super(OperationWizard, self).get_context_data(forms,
+ context = super(OperationWizard, self).get_context_data(form,
**kwargs)
#step = self.determine_step(request, storage)
step = self.steps.current
@@ -207,7 +206,7 @@ class OperationAdministrativeActWizard(OperationWizard):
else:
admact = models.AdministrativeAct(**dct)
admact.save()
- res = render_to_response('wizard_done.html', {},
+ res = render_to_response('ishtar/wizard/wizard_done.html', {},
context_instance=RequestContext(self.request))
return res
@@ -227,7 +226,7 @@ class AdministrativeActDeletionWizard(ClosingWizard):
def done(self, form_list, **kwargs):
obj = self.get_current_object()
obj.delete()
- return render_to_response('wizard_done.html', {},
+ return render_to_response('ishtar/wizard/wizard_delete_done.html', {},
context_instance=RequestContext(self.request))
def is_preventive(form_name, model, type_key='operation_type', key=''):