summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-10-06 14:49:10 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-10-06 14:49:10 +0200
commitdad03f626f1028daa44821a7d88551fec21ae88f (patch)
tree7db35133da25a55cfe1183260953aab882255309 /archaeological_context_records
parent4b1349b748e8dbd1ace541cc55562dba6bd9fe6f (diff)
downloadIshtar-dad03f626f1028daa44821a7d88551fec21ae88f.tar.bz2
Ishtar-dad03f626f1028daa44821a7d88551fec21ae88f.zip
Grids: manage multiple values in the same column
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/models.py1
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html2
-rw-r--r--archaeological_context_records/views.py34
3 files changed, 16 insertions, 21 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 8c80d81ed..eb62029aa 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -113,6 +113,7 @@ class ContextRecord(BaseHistorizedItem, OwnPerms, ShortMenuItem):
TABLE_COLS_FOR_OPE = [
'label', ['parcel.section', 'parcel.parcel_number'], 'unit',
'datings.period', 'description']
+ TABLE_COLS_FOR_OPE_LBL = {'section__parcel_number': _("Parcel")}
external_id = models.CharField(_(u"External ID"), blank=True, null=True,
max_length=120)
parcel = models.ForeignKey(Parcel, verbose_name=_(u"Parcel"),
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index a984ef8b5..bca027414 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -128,7 +128,7 @@
{% trans "Finds" as finds %}
{% if item.base_finds.count %}
-{% dynamic_table_document finds 'finds' 'base_finds__context_record' item.pk %}
+{% dynamic_table_document finds 'finds_for_ope' 'base_finds__context_record' item.pk 'TABLE_COLS_FOR_OPE' %}
{% endif %}
{% trans "Documents from associated finds" as find_docs %}
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index d64adc2a2..cbf34ee07 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -30,32 +30,26 @@ import models
show_contextrecord = show_item(models.ContextRecord, 'contextrecord')
revert_contextrecord = revert_item(models.ContextRecord)
+
+contextrecord_extra_keys = {
+ 'parcel__town': 'parcel__town__pk',
+ 'operation__year': 'operation__year__contains',
+ 'operation__code_patriarche': 'operation__code_patriarche',
+ 'operation__operation_code': 'operation__operation_code',
+ 'datings__period': 'datings__period__pk',
+ 'parcel_0': 'operation__parcels__section',
+ 'parcel_1': 'operation__parcels__parcel_number',
+ 'label': 'label__icontains'
+}
+
get_contextrecord = get_item(
models.ContextRecord,
'get_contextrecord', 'contextrecord',
- extra_request_keys={
- 'parcel__town': 'parcel__town__pk',
- 'operation__year': 'operation__year__contains',
- 'operation__code_patriarche': 'operation__code_patriarche',
- 'operation__operation_code': 'operation__operation_code',
- 'datings__period': 'datings__period__pk',
- 'parcel_0': 'operation__parcels__section',
- 'parcel_1': 'operation__parcels__parcel_number',
- 'label': 'label__icontains'
- },)
+ extra_request_keys=contextrecord_extra_keys,)
get_contextrecord_for_ope = get_item(
models.ContextRecord,
'get_contextrecord', 'contextrecord',
- extra_request_keys={
- 'parcel__town': 'parcel__town__pk',
- 'operation__year': 'operation__year__contains',
- 'operation__code_patriarche': 'operation__code_patriarche',
- 'operation__operation_code': 'operation__operation_code',
- 'datings__period': 'datings__period__pk',
- 'parcel_0': 'operation__parcels__section',
- 'parcel_1': 'operation__parcels__parcel_number',
- 'label': 'label__icontains'
- },
+ extra_request_keys=contextrecord_extra_keys,
own_table_cols=models.ContextRecord.TABLE_COLS_FOR_OPE)
get_contextrecordsource = get_item(
models.ContextRecordSource,