Patch that touches 'upstream' templates, for use in surveys.
Consists out of three changes.
1 - Move the </head> placement in base.hmtl to after the closing of
scripts_block, so templates that extend base.html can add scripts to
the <head>.
2 - Add tooltips for checkboxes inside fieldsets.
3 - Comment out an empty table row in templatetags/_as_table.html,
which probably has an arcane reason to stay empty :)
Reviewed by: Lennard de Rijk, Pawel Solyga
Patch by: Daniel Diniz, James Levy
from django.http import Http404
from django.shortcuts import render_to_response
###########
# CHOICES #
###########
def choice_list(request, app_label, module_name, field_name, models):
m, f = lookup_field(app_label, module_name, field_name, models)
return render_to_response('databrowse/choice_list.html', {'model': m, 'field': f})
def choice_detail(request, app_label, module_name, field_name, field_val, models):
m, f = lookup_field(app_label, module_name, field_name, models)
try:
label = dict(f.field.choices)[field_val]
except KeyError:
raise Http404('Invalid choice value given')
obj_list = m.objects(**{f.field.name: field_val})
return render_to_response('databrowse/choice_detail.html', {'model': m, 'field': f, 'value': label, 'object_list': obj_list})