summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/forms.py29
-rw-r--r--archaeological_context_records/locale/django.pot62
2 files changed, 49 insertions, 42 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index f3bbb1b65..4f10014de 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -36,7 +36,7 @@ import models
from ishtar_common import widgets
from archaeological_operations.widgets import OAWidget
from ishtar_common.forms import FinalForm, FormSet, \
- reverse_lazy, get_form_selection, TableSelect
+ reverse_lazy, get_form_selection, TableSelect, ManageOldType
from ishtar_common.forms_common import get_town_field, SourceSelect
from archaeological_operations.forms import OperationSelect, ParcelField,\
RecordRelationsForm as OpeRecordRelationsForm
@@ -114,7 +114,7 @@ class RecordFormSelection(forms.Form):
return cleaned_data
-class RecordFormGeneral(forms.Form):
+class RecordFormGeneral(ManageOldType, forms.Form):
form_label = _("General")
associated_models = {'parcel': Parcel, 'unit': models.Unit}
pk = forms.IntegerField(required=False, widget=forms.HiddenInput)
@@ -162,7 +162,8 @@ class RecordFormGeneral(forms.Form):
(" - ".join([k for k in key if k]),
[(parcel.pk, parcel.short_label) for parcel in gparcels])
)
- self.fields['unit'].choices = models.Unit.get_types()
+ self.fields['unit'].choices = models.Unit.get_types(
+ initial=self.init_data.get('unit'))
self.fields['unit'].help_text = models.Unit.get_help()
def clean(self):
@@ -180,7 +181,7 @@ class RecordFormGeneral(forms.Form):
return cleaned_data
-class DatingForm(forms.Form):
+class DatingForm(ManageOldType, forms.Form):
form_label = _("Dating")
base_model = 'dating'
associated_models = {'dating_type': models.DatingType,
@@ -195,11 +196,14 @@ class DatingForm(forms.Form):
def __init__(self, *args, **kwargs):
super(DatingForm, self).__init__(*args, **kwargs)
- self.fields['dating_type'].choices = models.DatingType.get_types()
+ self.fields['dating_type'].choices = models.DatingType.get_types(
+ initial=self.init_data.get('dating_type'))
self.fields['dating_type'].help_text = models.DatingType.get_help()
- self.fields['quality'].choices = models.DatingQuality.get_types()
+ self.fields['quality'].choices = models.DatingQuality.get_types(
+ initial=self.init_data.get('quality'))
self.fields['quality'].help_text = models.DatingQuality.get_help()
- self.fields['period'].choices = Period.get_types()
+ self.fields['period'].choices = Period.get_types(
+ initial=self.init_data.get('period'))
self.fields['period'].help_text = Period.get_help()
@@ -229,7 +233,8 @@ class RecordRelationsForm(OpeRecordRelationsForm):
kwargs.pop('files')
super(RecordRelationsForm, self).__init__(*args, **kwargs)
self.fields['relation_type'].choices = \
- models.RelationType.get_types()
+ models.RelationType.get_types(
+ initial=self.init_data.get('relation_type'))
if crs:
self.fields['right_record'].choices = [('', '-' * 2)] + crs
@@ -237,7 +242,7 @@ RecordRelationsFormSet = formset_factory(RecordRelationsForm, can_delete=True)
RecordRelationsFormSet.form_label = _(u"Relations")
-class RecordFormInterpretation(forms.Form):
+class RecordFormInterpretation(ManageOldType, forms.Form):
form_label = _("Interpretation")
associated_models = {'activity': models.ActivityType,
'identification': models.IdentificationType}
@@ -263,10 +268,12 @@ class RecordFormInterpretation(forms.Form):
def __init__(self, *args, **kwargs):
super(RecordFormInterpretation, self).__init__(*args, **kwargs)
- self.fields['activity'].choices = models.ActivityType.get_types()
+ self.fields['activity'].choices = models.ActivityType.get_types(
+ initial=self.init_data.get('activity'))
self.fields['activity'].help_text = models.ActivityType.get_help()
self.fields['identification'].choices = \
- models.IdentificationType.get_types()
+ models.IdentificationType.get_types(
+ initial=self.init_data.get('identification'))
self.fields['identification'].help_text = \
models.IdentificationType.get_help()
diff --git a/archaeological_context_records/locale/django.pot b/archaeological_context_records/locale/django.pot
index 8daef7bec..3f3ab428e 100644
--- a/archaeological_context_records/locale/django.pot
+++ b/archaeological_context_records/locale/django.pot
@@ -32,7 +32,7 @@ msgstr ""
msgid "Search within operation relations"
msgstr ""
-#: forms.py:64 forms.py:189 models.py:48
+#: forms.py:64 forms.py:190 models.py:48
msgid "Period"
msgstr ""
@@ -48,7 +48,7 @@ msgstr ""
msgid "Search within relations"
msgstr ""
-#: forms.py:98 forms.py:288 views.py:118
+#: forms.py:98 forms.py:295 views.py:118
msgid "Context record search"
msgstr ""
@@ -94,120 +94,120 @@ msgstr ""
msgid "Location"
msgstr ""
-#: forms.py:178
+#: forms.py:179
msgid "This ID already exists for this operation."
msgstr ""
-#: forms.py:184 forms.py:208 models.py:59
+#: forms.py:185 forms.py:212 models.py:59
msgid "Dating"
msgstr ""
-#: forms.py:190 models.py:49
+#: forms.py:191 models.py:49
msgid "Start date"
msgstr ""
-#: forms.py:191 models.py:50 models.py:135
+#: forms.py:192 models.py:50 models.py:135
msgid "End date"
msgstr ""
-#: forms.py:192 models.py:53
+#: forms.py:193 models.py:53
msgid "Quality"
msgstr ""
-#: forms.py:193 models.py:35 models.py:51
+#: forms.py:194 models.py:35 models.py:51
msgid "Dating type"
msgstr ""
-#: forms.py:217 ishtar_menu.py:29 models.py:354
+#: forms.py:221 ishtar_menu.py:29 models.py:354
msgid "Context record"
msgstr ""
-#: forms.py:237
+#: forms.py:242
msgid "Relations"
msgstr ""
-#: forms.py:241 forms.py:251 models.py:153
+#: forms.py:246 forms.py:256 models.py:153
#: templates/ishtar/sheet_contextrecord.html:37
msgid "Interpretation"
msgstr ""
-#: forms.py:245
+#: forms.py:250
msgid "Comments on dating"
msgstr ""
-#: forms.py:247 models.py:150
+#: forms.py:252 models.py:150
msgid "Has furniture?"
msgstr ""
-#: forms.py:249 models.py:152
+#: forms.py:254 models.py:152
msgid "Filling"
msgstr ""
-#: forms.py:253 models.py:173
+#: forms.py:258 models.py:173
msgid "Activity"
msgstr ""
-#: forms.py:255 models.py:171
+#: forms.py:260 models.py:171
msgid "Identification"
msgstr ""
-#: forms.py:257 models.py:156
+#: forms.py:262 models.py:156
msgid "TAQ"
msgstr ""
-#: forms.py:258 models.py:160
+#: forms.py:263 models.py:160
msgid "Estimated TAQ"
msgstr ""
-#: forms.py:260 models.py:163
+#: forms.py:265 models.py:163
msgid "TPQ"
msgstr ""
-#: forms.py:261 models.py:167
+#: forms.py:266 models.py:167
msgid "Estimated TPQ"
msgstr ""
-#: forms.py:274
+#: forms.py:281
msgid "Operation search"
msgstr ""
-#: forms.py:276
+#: forms.py:283
msgid "You should select an operation."
msgstr ""
-#: forms.py:281
+#: forms.py:288
msgid "Would you like to delete this context record?"
msgstr ""
-#: forms.py:290
+#: forms.py:297
msgid "You should select a context record."
msgstr ""
-#: forms.py:295
+#: forms.py:302
msgid "Year of the operation"
msgstr ""
-#: forms.py:297
+#: forms.py:304
msgid "Numeric reference"
msgstr ""
-#: forms.py:303
+#: forms.py:310
msgid "Town of the operation"
msgstr ""
-#: forms.py:305
+#: forms.py:312
msgid "Period of the context record"
msgstr ""
-#: forms.py:307
+#: forms.py:314
msgid "Unit type of the context record"
msgstr ""
-#: forms.py:320
+#: forms.py:327
msgid "Documentation search"
msgstr ""
-#: forms.py:322
+#: forms.py:329
msgid "You should select a document."
msgstr ""