diff options
Diffstat (limited to 'ishtar/ishtar_base/forms_context_records.py')
-rw-r--r-- | ishtar/ishtar_base/forms_context_records.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ishtar/ishtar_base/forms_context_records.py b/ishtar/ishtar_base/forms_context_records.py index 35b7b785c..27b7fc6f2 100644 --- a/ishtar/ishtar_base/forms_context_records.py +++ b/ishtar/ishtar_base/forms_context_records.py @@ -37,7 +37,7 @@ from forms import Wizard, FinalForm, FormSet, SearchWizard, DeletionWizard, \ formset_factory, get_now, reverse_lazy, get_form_selection from forms_common import get_town_field, SourceForm, SourceWizard, \ SourceSelect, AuthorFormset -from forms_operations import OperationFormSelection +from forms_operations import OperationSelect class RecordWizard(Wizard): model = models.ContextRecord @@ -51,7 +51,7 @@ class RecordWizard(Wizard): main_form_key = 'selec-' + self.url_name try: idx = int(self.session_get_value(request, storage, - main_form_key, 'pk')) + main_form_key, 'operation_id')) current_ope = models.Operation.objects.get(pk=idx) return current_ope except(TypeError, ValueError, ObjectDoesNotExist): @@ -95,7 +95,7 @@ class RecordWizard(Wizard): main_form_key = 'selec-' + self.url_name try: idx = int(self.session_get_value(request, storage, - main_form_key, 'pk')) + main_form_key, 'operation_id')) current_obj = models.Operation.objects.get(pk=idx) data['operation'] = current_obj except(TypeError, ValueError, ObjectDoesNotExist): @@ -163,12 +163,12 @@ class RecordFormGeneral(forms.Form): def __init__(self, *args, **kwargs): operation = None if 'data' in kwargs and kwargs['data'] and \ - ('operation' in kwargs['data'] or 'context_record' in kwargs['data']): + ('operation' in kwargs['data'] or 'context_record' in kwargs['data']): if 'operation' in kwargs['data']: operation = kwargs['data']['operation'] if 'context_record' in kwargs['data'] and \ kwargs['data']['context_record']: - operation = kwargs['data']['context_record'].parcel.operation + operation = kwargs['data']['context_record'].operation # clean data if not "real" data prefix_value = kwargs['prefix'] if not [k for k in kwargs['data'].keys() @@ -261,8 +261,14 @@ record_search_wizard = SearchWizard([ ('general-record_search', RecordFormSelection)], url_name='record_search',) +OperationRecordFormSelection = get_form_selection( + 'OperationRecordFormSelection', _(u"Operation search"), 'operation_id', + models.Operation, OperationSelect, 'get-operation', + _(u"You should select an operation.")) + + record_creation_wizard = RecordWizard([ - ('selec-record_creation', OperationFormSelection), + ('selec-record_creation', OperationRecordFormSelection), ('general-record_creation', RecordFormGeneral), ('datings-record_creation', DatingFormSet), ('interpretation-record_creation', RecordFormInterpretation), |