diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-09 18:09:37 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-01-09 18:11:10 +0100 |
commit | e8373b2d7c1ef6c554aeadd93b577001b049000e (patch) | |
tree | c65b5086bd4db147751de5a0d7d1b578d9c8944e /archaeological_context_records | |
parent | 042861251b5615c5c89740b82e45862c8fcde088 (diff) | |
download | Ishtar-e8373b2d7c1ef6c554aeadd93b577001b049000e.tar.bz2 Ishtar-e8373b2d7c1ef6c554aeadd93b577001b049000e.zip |
Contex record: fix relation tables
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/models.py | 17 | ||||
-rw-r--r-- | archaeological_context_records/urls.py | 3 | ||||
-rw-r--r-- | archaeological_context_records/views.py | 4 |
3 files changed, 18 insertions, 6 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 5e4d31c3b..cf39870ca 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -128,8 +128,9 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, if settings.COUNTRY == 'fr': TABLE_COLS.insert(1, 'operation__code_patriarche') TABLE_COLS_FOR_OPE = ['label', 'parcel', 'unit', - 'datings__period', 'description'] - COL_LABELS = {'section__parcel_number': _("Parcel")} + 'datings__period__label', 'description'] + COL_LABELS = {'section__parcel_number': _(u"Parcel"), + 'datings__period__label': _(u"Periods")} CONTEXTUAL_TABLE_COLS = { 'full': { 'related_context_records': 'detailled_related_context_records' @@ -401,10 +402,9 @@ class RecordRelations(GeneralRecordRelations, models.Model): relation_type = models.ForeignKey(RelationType) TABLE_COLS = [ "left_record__label", "left_record__unit", "left_record__parcel", - "left_record__datings__period", "left_record__description", "relation_type", "right_record__label", "right_record__unit", "right_record__parcel", - "right_record__datings__period", "right_record__description"] + ] COL_LABELS = { "left_record__label": _(u"ID (left)"), "left_record__unit": _(u"Unit (left)"), @@ -412,8 +412,8 @@ class RecordRelations(GeneralRecordRelations, models.Model): "left_record__description": _(u"Description (left)"), "left_record__datings__period": _(u"Periods (left)"), "relation_type": _(u"Relation type"), - "right_record__label": _(u"Unit (right)"), - "right_record__unit": _(u"Parcel (right)"), + "right_record__label": _(u"ID (right)"), + "right_record__unit": _(u"Unit (right)"), "right_record__parcel": _(u"Parcel (right)"), "right_record__description": _(u"Description (right)"), "right_record__datings__period": _(u"Periods (right)") @@ -456,6 +456,11 @@ class RecordRelationView(models.Model): "right_record__description": _(u"Description"), "right_record__datings__period": _(u"Periods") } + + # search parameters + EXTRA_REQUEST_KEYS = { + "left_record_id": "left_record_id" + } left_record = models.ForeignKey(ContextRecord, related_name='+', on_delete=models.DO_NOTHING) right_record = models.ForeignKey(ContextRecord, related_name='+', diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py index 8cfb1b391..341d321f9 100644 --- a/archaeological_context_records/urls.py +++ b/archaeological_context_records/urls.py @@ -97,6 +97,9 @@ urlpatterns += patterns( kwargs={'full': 'shortcut'}), url(r'get-contextrecordrelation/(?P<type>.+)?$', 'get_contextrecordrelation', name='get-contextrecordrelation'), + url(r'get-contextrecordrelationdetail/(?P<type>.+)?$', + 'get_contextrecordrelationdetail', + name='get-contextrecordrelationdetail'), url(r'show-contextrecordsource(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_contextrecordsource', name=models.ContextRecordSource.SHOW_URL), url(r'get-contexrecordsource/(?P<type>.+)?$', diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py index b79cd2671..cf3a13b3b 100644 --- a/archaeological_context_records/views.py +++ b/archaeological_context_records/views.py @@ -83,6 +83,10 @@ get_contextrecordrelation = get_item( models.RecordRelationView, 'get_contextrecordrelation', 'contextrecordrelation') +get_contextrecordrelationdetail = get_item( + models.RecordRelations, 'get_contextrecordrelationdetail', + 'contextrecordrelationdetail') + record_search_wizard = SearchWizard.as_view([ ('general-record_search', RecordFormSelection)], label=_(u"Context record search"), |