summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-06-02 17:27:03 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-06-02 17:27:03 +0200
commit51ab900d3a61c719923390be1fb980019ac1da56 (patch)
tree9154b617bfa283b915cde3686138b5dfc7f15208
parent7868245668607ab9fb618011e4880f15ec1ef7de (diff)
downloadIshtar-51ab900d3a61c719923390be1fb980019ac1da56.tar.bz2
Ishtar-51ab900d3a61c719923390be1fb980019ac1da56.zip
Add full export of operation's sources
-rw-r--r--archaeological_operations/forms.py3
-rw-r--r--archaeological_operations/urls.py3
-rw-r--r--ishtar_common/forms.py7
-rw-r--r--ishtar_common/templatetags/window_tables.py4
4 files changed, 12 insertions, 5 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 49824e24a..b61285177 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -1136,7 +1136,8 @@ class OperationSourceSelect(SourceSelect):
OperationSourceFormSelection = get_form_selection(
'OperationSourceFormSelection', _(u"Documentation search"), 'pk',
models.OperationSource, OperationSourceSelect, 'get-operationsource',
- _(u"You should select a document."))
+ _(u"You should select a document."),
+ get_full_url='get-operationsource-full')
################################################
# Administrative act management for operations #
diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py
index 76723deab..ef7d14dd6 100644
--- a/archaeological_operations/urls.py
+++ b/archaeological_operations/urls.py
@@ -130,6 +130,9 @@ urlpatterns += patterns(
'show_operationsource', name=models.OperationSource.SHOW_URL),
url(r'get-operationsource/(?P<type>.+)?$',
'get_operationsource', name='get-operationsource'),
+ url(r'get-operationsource-full/(?P<type>.+)?$',
+ 'get_operationsource', name='get-operationsource-full',
+ kwargs={'full': True}),
url(r'dashboard_operation/$', 'dashboard_operation',
name='dashboard-operation'),
url(r'autocomplete-archaeologicalsite/$',
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index a5abdddcd..5e0d14eb8 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -128,7 +128,7 @@ class ClosingDateFormSelection(forms.Form):
def get_form_selection(
class_name, label, key, model, base_form, get_url,
not_selected_error=_(u"You should select an item."), new=False,
- new_message=_(u"Add a new item")):
+ new_message=_(u"Add a new item"), get_full_url=None):
"""
Generate a class selection form
class_name -- name of the class
@@ -145,11 +145,14 @@ def get_form_selection(
'form_label': label,
'associated_models': {key: model},
'currents': {key: model}}
+ widget_kwargs = {"new": new, "new_message": new_message}
+ if get_full_url:
+ widget_kwargs['source_full'] = reverse_lazy(get_full_url)
attrs[key] = forms.IntegerField(
label="", required=False,
validators=[models.valid_id(model)],
widget=widgets.JQueryJqGrid(reverse_lazy(get_url), base_form, model,
- new=new, new_message=new_message))
+ **widget_kwargs))
def clean(self):
cleaned_data = self.cleaned_data
diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py
index 8be4e5559..6bed38201 100644
--- a/ishtar_common/templatetags/window_tables.py
+++ b/ishtar_common/templatetags/window_tables.py
@@ -27,8 +27,8 @@ def table_document(caption, data):
ASSOCIATED_MODELS = {}
ASSOCIATED_MODELS['files'] = (File, 'get-file', '')
-ASSOCIATED_MODELS['operation_docs'] = (OperationSource,
- 'get-operationsource', '')
+ASSOCIATED_MODELS['operation_docs'] = (
+ OperationSource, 'get-operationsource', 'get-operationsource-full')
ASSOCIATED_MODELS['operations'] = (Operation, 'get-operation', '')
ASSOCIATED_MODELS['context_records'] = (ContextRecord, 'get-contextrecord',
'get-contextrecord-full')