summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/forms.py17
-rw-r--r--archaeological_context_records/locale/django.pot158
-rw-r--r--archaeological_context_records/models.py3
-rw-r--r--archaeological_context_records/tests.py2
-rw-r--r--archaeological_context_records/wizards.py8
5 files changed, 99 insertions, 89 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py
index 522c69deb..91effb397 100644
--- a/archaeological_context_records/forms.py
+++ b/archaeological_context_records/forms.py
@@ -40,7 +40,7 @@ from ishtar_common.forms import FinalForm, FormSet, \
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
+ RecordRelationsForm as OpeRecordRelationsForm, RecordRelationsFormSetBase
class OperationFormSelection(forms.Form):
@@ -77,7 +77,7 @@ class RecordSelect(TableSelect):
datings__period = forms.ChoiceField(label=_(u"Period"), choices=[])
unit = forms.ChoiceField(label=_(u"Unit type"), choices=[])
parcel = ParcelField(label=_(u"Parcel (section/number/public domain)"))
- relation_types = forms.MultipleChoiceField(
+ cr_relation_types = forms.MultipleChoiceField(
label=_(u"Search within relations"), choices=[],
widget=forms.CheckboxSelectMultiple)
@@ -87,8 +87,8 @@ class RecordSelect(TableSelect):
self.fields['datings__period'].help_text = Period.get_help()
self.fields['unit'].choices = models.Unit.get_types()
self.fields['unit'].help_text = models.Unit.get_help()
- self.fields['relation_types'].choices = models.RelationType.get_types(
- empty_first=False)
+ self.fields['cr_relation_types'].choices = \
+ models.RelationType.get_types(empty_first=False)
self.fields['ope_relation_types'].choices = OpeRelationType.get_types(
empty_first=False)
@@ -98,9 +98,9 @@ class RecordSelect(TableSelect):
ids.append('parcel_0')
ids.append('parcel_1')
ids.append('parcel_2')
- ids.pop(ids.index('relation_types'))
- for idx, c in enumerate(self.fields['relation_types'].choices):
- ids.append('relation_types_{}'.format(idx))
+ ids.pop(ids.index('cr_relation_types'))
+ for idx, c in enumerate(self.fields['cr_relation_types'].choices):
+ ids.append('cr_relation_types_{}'.format(idx))
ids.pop(ids.index('ope_relation_types'))
for idx, c in enumerate(self.fields['ope_relation_types'].choices):
ids.append('ope_relation_types_{}'.format(idx))
@@ -302,7 +302,8 @@ class RecordRelationsForm(OpeRecordRelationsForm):
if crs:
self.fields['right_record'].choices = [('', '-' * 2)] + crs
-RecordRelationsFormSet = formset_factory(RecordRelationsForm, can_delete=True)
+RecordRelationsFormSet = formset_factory(
+ RecordRelationsForm, can_delete=True, formset=RecordRelationsFormSetBase)
RecordRelationsFormSet.form_label = _(u"Relations")
diff --git a/archaeological_context_records/locale/django.pot b/archaeological_context_records/locale/django.pot
index 2e507ce15..1617d6692 100644
--- a/archaeological_context_records/locale/django.pot
+++ b/archaeological_context_records/locale/django.pot
@@ -8,11 +8,11 @@
msgid ""
msgstr ""
-#: forms.py:47 forms.py:51 models.py:216 models.py:599 wizards.py:77
+#: forms.py:47 forms.py:51 models.py:217 models.py:600 wizards.py:77
msgid "Operation"
msgstr ""
-#: forms.py:59 forms.py:141 models.py:218 models.py:567
+#: forms.py:59 forms.py:141 models.py:219 models.py:568
msgid "ID"
msgstr ""
@@ -52,7 +52,7 @@ msgstr ""
msgid "Search within relations"
msgstr ""
-#: forms.py:111 forms.py:357 views.py:92
+#: forms.py:111 forms.py:358 views.py:92
msgid "Context record search"
msgstr ""
@@ -64,48 +64,48 @@ msgstr ""
msgid "General"
msgstr ""
-#: forms.py:140 models.py:181 models.py:214 models.py:569
+#: forms.py:140 models.py:181 models.py:215 models.py:570
msgid "Parcel"
msgstr ""
-#: forms.py:143 models.py:219 models.py:570
+#: forms.py:143 models.py:220 models.py:571
#: templates/ishtar/sheet_contextrecord.html:30
msgid "Description"
msgstr ""
-#: forms.py:145 models.py:220
+#: forms.py:145 models.py:221
msgid "General comment"
msgstr ""
-#: forms.py:148 models.py:267
+#: forms.py:148 models.py:268
msgid "Excavation technique"
msgstr ""
-#: forms.py:149 models.py:224
+#: forms.py:149 models.py:225
msgid "Length (m)"
msgstr ""
-#: forms.py:150 models.py:225
+#: forms.py:150 models.py:226
msgid "Width (m)"
msgstr ""
-#: forms.py:151 models.py:226
+#: forms.py:151 models.py:227
msgid "Thickness (m)"
msgstr ""
-#: forms.py:152 models.py:228
+#: forms.py:152 models.py:229
msgid "Diameter (m)"
msgstr ""
-#: forms.py:153 models.py:229
+#: forms.py:153 models.py:230
msgid "Depth (m)"
msgstr ""
-#: forms.py:155 models.py:231
+#: forms.py:155 models.py:232
msgid "Depth of appearance (m)"
msgstr ""
-#: forms.py:156 forms.py:376 models.py:241 models.py:568
+#: forms.py:156 forms.py:377 models.py:242 models.py:569
msgid "Context record type"
msgstr ""
@@ -113,7 +113,7 @@ msgstr ""
msgid "Documentation"
msgstr ""
-#: forms.py:162 models.py:233
+#: forms.py:162 models.py:234
msgid "Location"
msgstr ""
@@ -140,7 +140,7 @@ msgstr ""
msgid "Start date"
msgstr ""
-#: forms.py:256 models.py:58 models.py:223
+#: forms.py:256 models.py:58 models.py:224
msgid "End date"
msgstr ""
@@ -152,88 +152,88 @@ msgstr ""
msgid "Dating type"
msgstr ""
-#: forms.py:285 ishtar_menu.py:29 models.py:641
+#: forms.py:285 ishtar_menu.py:29 models.py:642
msgid "Context record"
msgstr ""
-#: forms.py:306
+#: forms.py:307
msgid "Relations"
msgstr ""
-#: forms.py:310 forms.py:318 models.py:244
+#: forms.py:311 forms.py:319 models.py:245
#: templates/ishtar/sheet_contextrecord.html:44
msgid "Interpretation"
msgstr ""
-#: forms.py:314
+#: forms.py:315
msgid "Comments on dating"
msgstr ""
-#: forms.py:316 models.py:243
+#: forms.py:317 models.py:244
msgid "Filling"
msgstr ""
-#: forms.py:320 models.py:264
+#: forms.py:321 models.py:265
msgid "Activity"
msgstr ""
-#: forms.py:322 models.py:262
+#: forms.py:323 models.py:263
msgid "Identification"
msgstr ""
-#: forms.py:324 models.py:247
+#: forms.py:325 models.py:248
msgid "TAQ"
msgstr ""
-#: forms.py:325 models.py:251
+#: forms.py:326 models.py:252
msgid "Estimated TAQ"
msgstr ""
-#: forms.py:327 models.py:254
+#: forms.py:328 models.py:255
msgid "TPQ"
msgstr ""
-#: forms.py:328 models.py:258
+#: forms.py:329 models.py:259
msgid "Estimated TPQ"
msgstr ""
-#: forms.py:343
+#: forms.py:344
msgid "Operation search"
msgstr ""
-#: forms.py:345
+#: forms.py:346
msgid "You should select an operation."
msgstr ""
-#: forms.py:350
+#: forms.py:351
msgid "Would you like to delete this context record?"
msgstr ""
-#: forms.py:359
+#: forms.py:360
msgid "You should select a context record."
msgstr ""
-#: forms.py:364
+#: forms.py:365
msgid "Year of the operation"
msgstr ""
-#: forms.py:366
+#: forms.py:367
msgid "Numeric reference"
msgstr ""
-#: forms.py:372
+#: forms.py:373
msgid "Town of the operation"
msgstr ""
-#: forms.py:374
+#: forms.py:375
msgid "Period of the context record"
msgstr ""
-#: forms.py:389
+#: forms.py:390
msgid "Documentation search"
msgstr ""
-#: forms.py:391
+#: forms.py:392
msgid "You should select a document."
msgstr ""
@@ -321,7 +321,7 @@ msgstr ""
msgid "Documentation types"
msgstr ""
-#: models.py:172 models.py:571
+#: models.py:172 models.py:572
msgid "Periods"
msgstr ""
@@ -345,172 +345,172 @@ msgstr ""
msgid "Parcel (year)"
msgstr ""
-#: models.py:211
+#: models.py:212
msgid "External ID"
msgstr ""
-#: models.py:213
+#: models.py:214
msgid "External ID is set automatically"
msgstr ""
-#: models.py:221
+#: models.py:222
msgid "Date d'ouverture"
msgstr ""
-#: models.py:234
+#: models.py:235
msgid "A short description of the location of the context record"
msgstr ""
-#: models.py:239
+#: models.py:240
msgid "Comment on datings"
msgstr ""
-#: models.py:248
+#: models.py:249
msgid ""
"\"Terminus Ante Quem\" the context record can't have been created after this "
"date"
msgstr ""
-#: models.py:252
+#: models.py:253
msgid "Estimation of a \"Terminus Ante Quem\""
msgstr ""
-#: models.py:255
+#: models.py:256
msgid ""
"\"Terminus Post Quem\" the context record can't have been created before "
"this date"
msgstr ""
-#: models.py:259
+#: models.py:260
msgid "Estimation of a \"Terminus Post Quem\""
msgstr ""
-#: models.py:270
+#: models.py:271
msgid "Point"
msgstr ""
-#: models.py:271
+#: models.py:272
msgid "Polygon"
msgstr ""
-#: models.py:272
+#: models.py:273
msgid "Cached name"
msgstr ""
-#: models.py:276 models.py:277 templates/ishtar/sheet_contextrecord.html:4
+#: models.py:277 models.py:278 templates/ishtar/sheet_contextrecord.html:4
msgid "Context Record"
msgstr ""
-#: models.py:279
+#: models.py:280
msgid "Can view all Context Records"
msgstr ""
-#: models.py:281
+#: models.py:282
msgid "Can view own Context Record"
msgstr ""
-#: models.py:283
+#: models.py:284
msgid "Can add own Context Record"
msgstr ""
-#: models.py:285
+#: models.py:286
msgid "Can change own Context Record"
msgstr ""
-#: models.py:287
+#: models.py:288
msgid "Can delete own Context Record"
msgstr ""
-#: models.py:297
+#: models.py:298
msgctxt "short"
msgid "Context record"
msgstr ""
-#: models.py:501
+#: models.py:502
msgid "Inverse relation"
msgstr ""
-#: models.py:505 models.py:528 models.py:566
+#: models.py:506 models.py:529 models.py:567
msgid "Relation type"
msgstr ""
-#: models.py:506
+#: models.py:507
msgid "Relation types"
msgstr ""
-#: models.py:523
+#: models.py:524
msgid "ID (left)"
msgstr ""
-#: models.py:524
+#: models.py:525
msgid "Context record type (left)"
msgstr ""
-#: models.py:525
+#: models.py:526
msgid "Parcel (left)"
msgstr ""
-#: models.py:526
+#: models.py:527
msgid "Description (left)"
msgstr ""
-#: models.py:527
+#: models.py:528
msgid "Periods (left)"
msgstr ""
-#: models.py:529
+#: models.py:530
msgid "ID (right)"
msgstr ""
-#: models.py:530
+#: models.py:531
msgid "Context record type (right)"
msgstr ""
-#: models.py:531
+#: models.py:532
msgid "Parcel (right)"
msgstr ""
-#: models.py:532
+#: models.py:533
msgid "Description (right)"
msgstr ""
-#: models.py:533
+#: models.py:534
msgid "Periods (right)"
msgstr ""
-#: models.py:542
+#: models.py:543
msgid "Record relation"
msgstr ""
-#: models.py:543
+#: models.py:544
msgid "Record relations"
msgstr ""
-#: models.py:626
+#: models.py:627
msgid "Context record documentation"
msgstr ""
-#: models.py:627
+#: models.py:628
msgid "Context record documentations"
msgstr ""
-#: models.py:630
+#: models.py:631
msgid "Can view all Context record sources"
msgstr ""
-#: models.py:632
+#: models.py:633
msgid "Can view own Context record source"
msgstr ""
-#: models.py:634
+#: models.py:635
msgid "Can add own Context record source"
msgstr ""
-#: models.py:636
+#: models.py:637
msgid "Can change own Context record source"
msgstr ""
-#: models.py:638
+#: models.py:639
msgid "Can delete own Context record source"
msgstr ""
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index b838b9a57..883433517 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -204,7 +204,8 @@ class ContextRecord(BulkUpdatedItem, BaseHistorizedItem, ImageModel, OwnPerms,
'archaeological_sites': 'operation__archaeological_sites__pk',
'cached_label': 'cached_label__icontains',
}
- RELATION_TYPES_PREFIX = {'ope_relation_types': 'operation__'}
+ RELATION_TYPES_PREFIX = {'ope_relation_types': 'operation__',
+ 'cr_relation_types': ''}
RELATIVE_SESSION_NAMES = [
('operation', 'operation__pk'),
('file', 'operation__associated_file__pk')]
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py
index e697459b5..df05f4898 100644
--- a/archaeological_context_records/tests.py
+++ b/archaeological_context_records/tests.py
@@ -369,7 +369,7 @@ class ContextRecordSearchTest(ContextRecordInit, TestCase):
# test search between relations
response = c.get(reverse('get-contextrecord'),
{'label': 'cr 1',
- 'relation_types_0': self.cr_rel_type.pk})
+ 'cr_relation_types_0': self.cr_rel_type.pk})
self.assertEqual(json.loads(response.content)['total'], 2)
# test search between related operations
first_ope = self.operations[0]
diff --git a/archaeological_context_records/wizards.py b/archaeological_context_records/wizards.py
index fd48ef3d9..cbeb1c1d2 100644
--- a/archaeological_context_records/wizards.py
+++ b/archaeological_context_records/wizards.py
@@ -134,6 +134,14 @@ class RecordModifWizard(RecordWizard):
model = models.ContextRecord
filter_owns = {'selec-record_modification': ['pk']}
+ def get_form_kwargs(self, step, **kwargs):
+ kwargs = super(RecordModifWizard, self).get_form_kwargs(
+ step, **kwargs)
+ if step != "relations-record_modification":
+ return kwargs
+ kwargs["left_record"] = self.get_current_object()
+ return kwargs
+
class RecordDeletionWizard(DeletionWizard):
model = models.ContextRecord