Remove use of 'navigation_object_name' template variable and simplify the use of the 'navigation_object_list' template variable

This commit is contained in:
Roberto Rosario
2015-04-05 01:45:30 -04:00
parent 31c49a2493
commit db340513d0
9 changed files with 107 additions and 169 deletions

View File

@@ -53,10 +53,7 @@ def acl_list_for(request, obj, extra_context=None):
'hide_object': True, 'hide_object': True,
'access_object': AccessObject.encapsulate(obj), 'access_object': AccessObject.encapsulate(obj),
'object': obj, 'object': obj,
'navigation_object_list': [ 'navigation_object_list': ['object', 'access_object'],
{'object': 'object'},
{'object': 'access_object'}
],
} }
if extra_context: if extra_context:
@@ -123,10 +120,7 @@ def acl_detail_for(request, actor, obj):
'object_gid': lambda x: obj.gid, 'object_gid': lambda x: obj.gid,
}, },
'access_object': obj, 'access_object': obj,
'navigation_object_list': [ 'navigation_object_list': ['object', 'access_object'],
{'object': 'object'},
{'object': 'access_object'}
],
} }
return render_to_response('appearance/generic_detail.html', context, return render_to_response('appearance/generic_detail.html', context,
@@ -347,10 +341,7 @@ def acl_new_holder_for(request, obj, extra_context=None, navigation_object=None)
'submit_label': _('Select'), 'submit_label': _('Select'),
'object': obj, 'object': obj,
'access_object': AccessObject.encapsulate(obj), 'access_object': AccessObject.encapsulate(obj),
'navigation_object_list': [ 'navigation_object_list': ['object', 'access_object'],
{'object': 'object'},
{'object': 'access_object'},
],
} }
if extra_context: if extra_context:

View File

@@ -98,7 +98,7 @@ def index_setup_edit(request, index_pk):
'title': _('Edit index: %s') % index, 'title': _('Edit index: %s') % index,
'form': form, 'form': form,
'index': index, 'index': index,
'navigation_object_name': 'index', 'navigation_object_list': ['index'],
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -127,7 +127,7 @@ def index_setup_delete(request, index_pk):
context = { context = {
'index': index, 'index': index,
'navigation_object_name': 'index', 'navigation_object_list': ['index'],
'delete_view': True, 'delete_view': True,
'previous': previous, 'previous': previous,
'next': next, 'next': next,
@@ -152,7 +152,7 @@ def index_setup_view(request, index_pk):
'object_list': object_list, 'object_list': object_list,
'index': index, 'index': index,
'list_object_variable_name': 'node', 'list_object_variable_name': 'node',
'navigation_object_name': 'index', 'navigation_object_list': ['index'],
'title': _('Tree template nodes for index: %s') % index, 'title': _('Tree template nodes for index: %s') % index,
'hide_object': True, 'hide_object': True,
'extra_columns': [ 'extra_columns': [
@@ -184,8 +184,8 @@ def index_setup_document_types(request, index_pk):
right_list_title=_('Document types for index: %s') % index, right_list_title=_('Document types for index: %s') % index,
decode_content_type=True, decode_content_type=True,
extra_context={ extra_context={
'navigation_object_name': 'index',
'index': index, 'index': index,
'navigation_object_list': ['index'],
} }
) )
@@ -209,10 +209,10 @@ def template_node_create(request, parent_pk):
form = IndexTemplateNodeForm(initial={'index': parent_node.index, 'parent': parent_node}) form = IndexTemplateNodeForm(initial={'index': parent_node.index, 'parent': parent_node})
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Create child node'),
'form': form, 'form': form,
'index': parent_node.index, 'index': parent_node.index,
'navigation_object_name': 'index', 'navigation_object_list': ['index'],
'title': _('Create child node'),
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -234,15 +234,11 @@ def template_node_edit(request, node_pk):
form = IndexTemplateNodeForm(instance=node) form = IndexTemplateNodeForm(instance=node)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Edit index template node: %s') % node,
'form': form, 'form': form,
'index': node.index, 'index': node.index,
'navigation_object_list': ['index', 'node'],
'node': node, 'node': node,
'title': _('Edit index template node: %s') % node,
'navigation_object_list': [
{'object': 'index', 'name': _('Index')},
{'object': 'node', 'name': _('Node')}
],
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -271,16 +267,12 @@ def template_node_delete(request, node_pk):
context = { context = {
'delete_view': True, 'delete_view': True,
'previous': previous,
'next': next,
'title': _('Are you sure you with to delete the index template node: %s?') % node,
'index': node.index, 'index': node.index,
'navigation_object_list': ['index', 'node'],
'next': next,
'node': node, 'node': node,
'title': _('Are you sure you with to delete the index template node: %s?') % node,
'navigation_object_list': [ 'previous': previous,
{'object': 'index', 'name': _('Index')},
{'object': 'node', 'name': _('Node')}
],
} }
return render_to_response('appearance/generic_confirm.html', context, return render_to_response('appearance/generic_confirm.html', context,

View File

@@ -86,15 +86,8 @@ class WorkflowInstanceDetailView(SingleObjectListView):
) )
context = { context = {
'navigation_object_list': ['object', 'workflow_instance'],
'object': self.get_workflow_instance().document, 'object': self.get_workflow_instance().document,
'workflow_instance': self.get_workflow_instance(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
'title': _('Detail of workflow: %(workflow)s') % {
'workflow': self.get_workflow_instance()
},
'subtemplates_list': [ 'subtemplates_list': [
{ {
'name': 'appearance/generic_detail_subtemplate.html', 'name': 'appearance/generic_detail_subtemplate.html',
@@ -110,7 +103,11 @@ class WorkflowInstanceDetailView(SingleObjectListView):
'hide_object': True, 'hide_object': True,
} }
} }
] ],
'title': _('Detail of workflow: %(workflow)s') % {
'workflow': self.get_workflow_instance()
},
'workflow_instance': self.get_workflow_instance(),
} }
return context return context
@@ -146,14 +143,11 @@ class WorkflowInstanceTransitionView(FormView):
context.update( context.update(
{ {
'navigation_object_list': ['object', 'workflow_instance'],
'object': self.get_workflow_instance().document, 'object': self.get_workflow_instance().document,
'workflow_instance': self.get_workflow_instance(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
'title': _('Do transition for workflow: %s') % self.get_workflow_instance(),
'submit_label': _('Submit'), 'submit_label': _('Submit'),
'title': _('Do transition for workflow: %s') % self.get_workflow_instance(),
'workflow_instance': self.get_workflow_instance(),
} }
) )
@@ -270,12 +264,9 @@ class SetupWorkflowStateDeleteView(SingleObjectDeleteView):
context.update( context.update(
{ {
'navigation_object_list': ['object', 'workflow_instance'],
'object': self.get_object().workflow, 'object': self.get_object().workflow,
'workflow_instance': self.get_object(), 'workflow_instance': self.get_object(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
} }
) )
@@ -295,12 +286,9 @@ class SetupWorkflowStateEditView(SingleObjectEditView):
context.update( context.update(
{ {
'navigation_object_list': ['object', 'workflow_instance'],
'object': self.get_object().workflow, 'object': self.get_object().workflow,
'workflow_instance': self.get_object(), 'workflow_instance': self.get_object(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
} }
) )
@@ -398,11 +386,8 @@ class SetupWorkflowTransitionDeleteView(SingleObjectDeleteView):
context.update( context.update(
{ {
'object': self.get_object().workflow, 'object': self.get_object().workflow,
'navigation_object_list': ['object', 'workflow_instance'],
'workflow_instance': self.get_object(), 'workflow_instance': self.get_object(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
} }
) )
@@ -422,12 +407,9 @@ class SetupWorkflowTransitionEditView(SingleObjectEditView):
context.update( context.update(
{ {
'navigation_object_list': ['object', 'workflow_instance'],
'object': self.get_object().workflow, 'object': self.get_object().workflow,
'workflow_instance': self.get_object(), 'workflow_instance': self.get_object(),
'navigation_object_list': [
{'object': 'object'},
{'object': 'workflow_instance'}
],
} }
) )

View File

@@ -583,14 +583,14 @@ def document_page_view(request, document_page_id):
zoom_text = '' zoom_text = ''
return render_to_response('appearance/generic_detail.html', { return render_to_response('appearance/generic_detail.html', {
'page': document_page,
'access_object': document_page.document, 'access_object': document_page.document,
'navigation_object_list': [{'object': 'page'}],
'web_theme_hide_menus': True,
'form': document_page_form, 'form': document_page_form,
'title': ' '.join([base_title, zoom_text]), 'navigation_object_list': ['page'],
'zoom': zoom, 'page': document_page,
'rotation': rotation, 'rotation': rotation,
'title': ' '.join([base_title, zoom_text]),
'web_theme_hide_menus': True,
'zoom': zoom,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -608,12 +608,12 @@ def document_page_text(request, document_page_id):
document_page_form = DocumentPageForm_text(instance=document_page) document_page_form = DocumentPageForm_text(instance=document_page)
return render_to_response('appearance/generic_detail.html', { return render_to_response('appearance/generic_detail.html', {
'page': document_page,
'navigation_object_list': [{'object': 'page'}],
'web_theme_hide_menus': True,
'form': document_page_form,
'title': _('Details for: %s') % document_page,
'access_object': document_page.document, 'access_object': document_page.document,
'form': document_page_form,
'page': document_page,
'navigation_object_list': ['page'],
'title': _('Details for: %s') % document_page,
'web_theme_hide_menus': True,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -637,12 +637,12 @@ def document_page_edit(request, document_page_id):
form = DocumentPageForm_edit(instance=document_page) form = DocumentPageForm_edit(instance=document_page)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'access_object': document_page.document,
'form': form, 'form': form,
'navigation_object_list': ['page'],
'page': document_page, 'page': document_page,
'navigation_object_list': [{'object': 'page'}],
'title': _('Edit: %s') % document_page, 'title': _('Edit: %s') % document_page,
'web_theme_hide_menus': True, 'web_theme_hide_menus': True,
'access_object': document_page.document,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -887,11 +887,11 @@ def document_type_edit(request, document_type_id):
form = DocumentTypeForm(instance=document_type) form = DocumentTypeForm(instance=document_type)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Edit document type: %s') % document_type,
'form': form,
'navigation_object_list': [{'object': 'document_type'}],
'document_type': document_type, 'document_type': document_type,
'next': next 'form': form,
'navigation_object_list': ['document_type'],
'next': next,
'title': _('Edit document type: %s') % document_type,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -915,13 +915,13 @@ def document_type_delete(request, document_type_id):
return HttpResponseRedirect(next) return HttpResponseRedirect(next)
context = { context = {
'document_type': document_type,
'delete_view': True, 'delete_view': True,
'navigation_object_list': [{'object': 'document_type'}], 'document_type': document_type,
'message': _('All documents of this type will be deleted too.'),
'navigation_object_list': ['document_type'],
'next': next, 'next': next,
'previous': previous, 'previous': previous,
'title': _('Are you sure you wish to delete the document type: %s?') % document_type, 'title': _('Are you sure you wish to delete the document type: %s?') % document_type,
'message': _('All documents of this type will be deleted too.'),
} }
return render_to_response('appearance/generic_confirm.html', context, return render_to_response('appearance/generic_confirm.html', context,
@@ -955,18 +955,18 @@ def document_type_filename_list(request, document_type_id):
document_type = get_object_or_404(DocumentType, pk=document_type_id) document_type = get_object_or_404(DocumentType, pk=document_type_id)
context = { context = {
'object_list': document_type.filenames.all(),
'title': _('Filenames for document type: %s') % document_type,
'navigation_object_list': [{'object': 'document_type'}],
'document_type': document_type, 'document_type': document_type,
'list_object_variable_name': 'filename',
'hide_link': True,
'extra_columns': [ 'extra_columns': [
{ {
'name': _('Enabled'), 'name': _('Enabled'),
'attribute': encapsulate(lambda x: two_state_template(x.enabled)), 'attribute': encapsulate(lambda x: two_state_template(x.enabled)),
} }
] ],
'hide_link': True,
'list_object_variable_name': 'filename',
'navigation_object_list': ['document_type'],
'object_list': document_type.filenames.all(),
'title': _('Filenames for document type: %s') % document_type,
} }
return render_to_response('appearance/generic_list.html', context, return render_to_response('appearance/generic_list.html', context,
@@ -994,17 +994,14 @@ def document_type_filename_edit(request, document_type_filename_id):
form = DocumentTypeFilenameForm(instance=document_type_filename) form = DocumentTypeFilenameForm(instance=document_type_filename)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'document_type': document_type_filename.document_type,
'filename': document_type_filename,
'form': form,
'navigation_object_list': ['document_type', 'filename'],
'next': next,
'title': _('Edit filename "%(filename)s" from document type "%(document_type)s"') % { 'title': _('Edit filename "%(filename)s" from document type "%(document_type)s"') % {
'document_type': document_type_filename.document_type, 'filename': document_type_filename 'document_type': document_type_filename.document_type, 'filename': document_type_filename
}, },
'form': form,
'next': next,
'filename': document_type_filename,
'document_type': document_type_filename.document_type,
'navigation_object_list': [
{'object': 'document_type'},
{'object': 'filename'}
],
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -1029,14 +1026,11 @@ def document_type_filename_delete(request, document_type_filename_id):
context = { context = {
'delete_view': True, 'delete_view': True,
'previous': previous,
'next': next,
'filename': document_type_filename,
'document_type': document_type_filename.document_type, 'document_type': document_type_filename.document_type,
'navigation_object_list': [ 'filename': document_type_filename,
{'object': 'document_type'}, 'previous': previous,
{'object': 'filename'} 'navigation_object_list': ['document_type', 'filename'],
], 'next': next,
'title': _('Are you sure you wish to delete the filename: %(filename)s, from document type "%(document_type)s"?') % { 'title': _('Are you sure you wish to delete the filename: %(filename)s, from document type "%(document_type)s"?') % {
'document_type': document_type_filename.document_type, 'filename': document_type_filename 'document_type': document_type_filename.document_type, 'filename': document_type_filename
}, },
@@ -1070,12 +1064,10 @@ def document_type_filename_create(request, document_type_id):
form = DocumentTypeFilenameForm_create() form = DocumentTypeFilenameForm_create()
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Create filename for document type: %s') % document_type,
'form': form,
'document_type': document_type, 'document_type': document_type,
'navigation_object_list': [ 'form': form,
{'object': 'document_type'}, 'navigation_object_list': ['document_type'],
], 'title': _('Create filename for document type: %s') % document_type,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -1177,7 +1169,7 @@ def document_page_transformation_list(request, document_page_id):
context = { context = {
'object_list': document_page.documentpagetransformation_set.all(), 'object_list': document_page.documentpagetransformation_set.all(),
'page': document_page, 'page': document_page,
'navigation_object_name': 'page', 'navigation_object_list': ['page'],
'title': _('Transformations for: %s') % document_page, 'title': _('Transformations for: %s') % document_page,
'web_theme_hide_menus': True, 'web_theme_hide_menus': True,
'list_object_variable_name': 'transformation', 'list_object_variable_name': 'transformation',
@@ -1215,7 +1207,7 @@ def document_page_transformation_create(request, document_page_id):
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'form': form, 'form': form,
'page': document_page, 'page': document_page,
'navigation_object_name': 'page', 'navigation_object_list': ['page'],
'title': _('Create new transformation for page: %(page)s of document: %(document)s') % { 'title': _('Create new transformation for page: %(page)s of document: %(document)s') % {
'page': document_page.page_number, 'document': document_page.document}, 'page': document_page.page_number, 'document': document_page.document},
'web_theme_hide_menus': True, 'web_theme_hide_menus': True,
@@ -1242,15 +1234,12 @@ def document_page_transformation_edit(request, document_page_transformation_id):
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'form': form, 'form': form,
'transformation': document_page_transformation, 'navigation_object_list': ['page', 'transformation'],
'page': document_page_transformation.document_page, 'page': document_page_transformation.document_page,
'navigation_object_list': [
{'object': 'page'},
{'object': 'transformation', 'name': _('Transformation')}
],
'title': _('Edit transformation "%(transformation)s" for: %(document_page)s') % { 'title': _('Edit transformation "%(transformation)s" for: %(document_page)s') % {
'transformation': document_page_transformation.get_transformation_display(), 'transformation': document_page_transformation.get_transformation_display(),
'document_page': document_page_transformation.document_page}, 'document_page': document_page_transformation.document_page},
'transformation': document_page_transformation,
'web_theme_hide_menus': True, 'web_theme_hide_menus': True,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -1273,15 +1262,12 @@ def document_page_transformation_delete(request, document_page_transformation_id
return render_to_response('appearance/generic_confirm.html', { return render_to_response('appearance/generic_confirm.html', {
'delete_view': True, 'delete_view': True,
'navigation_object_list': ['page', 'transformation'],
'page': document_page_transformation.document_page, 'page': document_page_transformation.document_page,
'transformation': document_page_transformation, 'previous': previous,
'navigation_object_list': [
{'object': 'page'},
{'object': 'transformation', 'name': _('Transformation')}
],
'title': _('Are you sure you wish to delete transformation "%(transformation)s" for: %(document_page)s') % { 'title': _('Are you sure you wish to delete transformation "%(transformation)s" for: %(document_page)s') % {
'transformation': document_page_transformation.get_transformation_display(), 'transformation': document_page_transformation.get_transformation_display(),
'document_page': document_page_transformation.document_page}, 'document_page': document_page_transformation.document_page},
'transformation': document_page_transformation,
'web_theme_hide_menus': True, 'web_theme_hide_menus': True,
'previous': previous,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))

View File

@@ -285,17 +285,13 @@ def smart_link_condition_edit(request, smart_link_condition_pk):
form = SmartLinkConditionForm(instance=smart_link_condition) form = SmartLinkConditionForm(instance=smart_link_condition)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'form': form,
'title': _('Edit smart link condition'),
'next': next,
'previous': previous,
'condition': smart_link_condition, 'condition': smart_link_condition,
'form': form,
'navigation_object_list': ['object', 'condition'],
'next': next,
'object': smart_link_condition.smart_link, 'object': smart_link_condition.smart_link,
'navigation_object_list': [ 'previous': previous,
{'object': 'object', 'name': _('Smart link')}, 'title': _('Edit smart link condition'),
{'object': 'condition', 'name': _('Condition')}
],
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -322,16 +318,13 @@ def smart_link_condition_delete(request, smart_link_condition_pk):
return HttpResponseRedirect(next) return HttpResponseRedirect(next)
return render_to_response('appearance/generic_confirm.html', { return render_to_response('appearance/generic_confirm.html', {
'delete_view': True,
'condition': smart_link_condition, 'condition': smart_link_condition,
'object': smart_link_condition.smart_link, 'delete_view': True,
'navigation_object_list': [ 'navigation_object_list': ['object', 'condition'],
{'object': 'object', 'name': _('Smart link')},
{'object': 'condition', 'name': _('Condition')}
],
'title': _('Are you sure you wish to delete smart link condition: "%s"?') % smart_link_condition,
'next': next, 'next': next,
'object': smart_link_condition.smart_link,
'previous': previous, 'previous': previous,
'title': _('Are you sure you wish to delete smart link condition: "%s"?') % smart_link_condition,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))

View File

@@ -16,7 +16,7 @@ class MainApp(apps.AppConfig):
verbose_name = _('Main') verbose_name = _('Main')
def ready(self): def ready(self):
menu_main.bind_links(links=[link_setup], position=-2) menu_main.bind_links(links=[link_setup], position=1)
menu_main.bind_links(links=[link_tools], position=-3) menu_main.bind_links(links=[link_tools], position=-3)
menu_setup.bind_links(links=[link_admin_site]) menu_setup.bind_links(links=[link_admin_site])
menu_tools.bind_links(links=[link_maintenance_menu]) menu_tools.bind_links(links=[link_maintenance_menu])

View File

@@ -472,8 +472,8 @@ def setup_document_type_metadata(request, document_type_id):
remove_method=lambda x: x.delete(), remove_method=lambda x: x.delete(),
extra_context={ extra_context={
'document_type': document_type, 'document_type': document_type,
'navigation_object_name': 'document_type',
'main_title': _('Optional metadata types for document type: %s') % document_type, 'main_title': _('Optional metadata types for document type: %s') % document_type,
'navigation_object_list': ['document_type'],
}, },
decode_content_type=True, decode_content_type=True,
) )
@@ -492,8 +492,8 @@ def setup_document_type_metadata_required(request, document_type_id):
remove_method=lambda x: x.delete(), remove_method=lambda x: x.delete(),
extra_context={ extra_context={
'document_type': document_type, 'document_type': document_type,
'navigation_object_name': 'document_type',
'main_title': _('Required metadata types for document type: %s') % document_type, 'main_title': _('Required metadata types for document type: %s') % document_type,
'navigation_object_list': ['document_type'],
}, },
decode_content_type=True, decode_content_type=True,
) )

View File

@@ -43,7 +43,7 @@ class Menu(object):
def bind_links(self, links, sources=None, position=0): def bind_links(self, links, sources=None, position=0):
""" """
Associate a link to a model, a view, or an url inside this menu Associate a link to a model, a view inside this menu
""" """
if sources: if sources:
for source in sources: for source in sources:
@@ -79,12 +79,12 @@ class Menu(object):
result = [] result = []
navigation_object_list = context.get('navigation_object_list', [{'object': 'object'}]) navigation_object_list = context.get('navigation_object_list', ['object'])
# Multiple objects # Multiple objects
for navigation_object in navigation_object_list: for navigation_object in navigation_object_list:
try: try:
resolved_navigation_object_list.append(Variable(navigation_object['object']).resolve(context)) resolved_navigation_object_list.append(Variable(navigation_object).resolve(context))
except VariableDoesNotExist: except VariableDoesNotExist:
pass pass

View File

@@ -391,12 +391,12 @@ def setup_source_edit(request, source_id):
form = form_class(instance=source) form = form_class(instance=source)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Edit source: %s') % source,
'form': form, 'form': form,
'source': source, 'navigation_object_list': ['source'],
'navigation_object_name': 'source',
'next': next, 'next': next,
'source': source,
'source_type': source.source_type, 'source_type': source.source_type,
'title': _('Edit source: %s') % source,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -418,12 +418,12 @@ def setup_source_delete(request, source_id):
return HttpResponseRedirect(redirect_view) return HttpResponseRedirect(redirect_view)
context = { context = {
'title': _('Are you sure you wish to delete the source: %s?') % source,
'source': source,
'navigation_object_name': 'source',
'delete_view': True, 'delete_view': True,
'navigation_object_list': ['source'],
'previous': previous, 'previous': previous,
'source': source,
'source_type': source.source_type, 'source_type': source.source_type,
'title': _('Are you sure you wish to delete the source: %s?') % source,
} }
return render_to_response('appearance/generic_confirm.html', context, return render_to_response('appearance/generic_confirm.html', context,
@@ -449,10 +449,10 @@ def setup_source_create(request, source_type):
form = form_class() form = form_class()
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Create new source of type: %s') % cls.class_fullname(),
'form': form, 'form': form,
'navigation_object_list': ['source'],
'source_type': source_type, 'source_type': source_type,
'navigation_object_name': 'source', 'title': _('Create new source of type: %s') % cls.class_fullname(),
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -462,11 +462,6 @@ def setup_source_transformation_list(request, source_id):
source = get_object_or_404(Source.objects.select_subclasses(), pk=source_id) source = get_object_or_404(Source.objects.select_subclasses(), pk=source_id)
context = { context = {
'object_list': SourceTransformation.transformations.get_for_object(source),
'title': _('Transformations for: %s') % source.fullname(),
'source': source,
'navigation_object_name': 'source',
'list_object_variable_name': 'transformation',
'extra_columns': [ 'extra_columns': [
{'name': _('Order'), 'attribute': 'order'}, {'name': _('Order'), 'attribute': 'order'},
{'name': _('Transformation'), 'attribute': encapsulate(lambda x: x.get_transformation_display())}, {'name': _('Transformation'), 'attribute': encapsulate(lambda x: x.get_transformation_display())},
@@ -474,6 +469,11 @@ def setup_source_transformation_list(request, source_id):
], ],
'hide_link': True, 'hide_link': True,
'hide_object': True, 'hide_object': True,
'list_object_variable_name': 'transformation',
'navigation_object_list': ['source'],
'object_list': SourceTransformation.transformations.get_for_object(source),
'source': source,
'title': _('Transformations for: %s') % source.fullname(),
} }
return render_to_response('appearance/generic_list.html', context, return render_to_response('appearance/generic_list.html', context,
@@ -500,15 +500,12 @@ def setup_source_transformation_edit(request, transformation_id):
form = SourceTransformationForm(instance=source_transformation) form = SourceTransformationForm(instance=source_transformation)
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'title': _('Edit transformation: %s') % source_transformation,
'form': form, 'form': form,
'navigation_object_list': ['source', 'transformation'],
'next': next,
'source': source_transformation.content_object, 'source': source_transformation.content_object,
'transformation': source_transformation, 'transformation': source_transformation,
'navigation_object_list': [ 'title': _('Edit transformation: %s') % source_transformation,
{'object': 'source', 'name': _('Source')},
{'object': 'transformation', 'name': _('Transformation')}
],
'next': next,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -531,16 +528,13 @@ def setup_source_transformation_delete(request, transformation_id):
return render_to_response('appearance/generic_confirm.html', { return render_to_response('appearance/generic_confirm.html', {
'delete_view': True, 'delete_view': True,
'transformation': source_transformation, 'navigation_object_list': ['source', 'transformation'],
'previous': previous,
'source': source_transformation.content_object, 'source': source_transformation.content_object,
'navigation_object_list': [
{'object': 'source', 'name': _('Source')},
{'object': 'transformation', 'name': _('Transformation')}
],
'title': _('Are you sure you wish to delete source transformation "%(transformation)s"') % { 'title': _('Are you sure you wish to delete source transformation "%(transformation)s"') % {
'transformation': source_transformation.get_transformation_display(), 'transformation': source_transformation.get_transformation_display(),
}, },
'previous': previous, 'transformation': source_transformation,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
@@ -568,6 +562,6 @@ def setup_source_transformation_create(request, source_id):
return render_to_response('appearance/generic_form.html', { return render_to_response('appearance/generic_form.html', {
'form': form, 'form': form,
'source': source, 'source': source,
'navigation_object_name': 'source', 'navigation_object_list': ['source'],
'title': _('Create new transformation for source: %s') % source, 'title': _('Create new transformation for source: %s') % source,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))