|
Revision 8046, 0.8 kB
(checked in by adrian, 4 months ago)
|
Fixed #7847 -- Removed a whole bunch of unused imports from throughout the codebase. Thanks, julien
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
from django.http import Http404 |
|---|
| 2 |
from django.shortcuts import render_to_response |
|---|
| 3 |
|
|---|
| 4 |
########### |
|---|
| 5 |
# CHOICES # |
|---|
| 6 |
########### |
|---|
| 7 |
|
|---|
| 8 |
def choice_list(request, app_label, module_name, field_name, models): |
|---|
| 9 |
m, f = lookup_field(app_label, module_name, field_name, models) |
|---|
| 10 |
return render_to_response('databrowse/choice_list.html', {'model': m, 'field': f}) |
|---|
| 11 |
|
|---|
| 12 |
def choice_detail(request, app_label, module_name, field_name, field_val, models): |
|---|
| 13 |
m, f = lookup_field(app_label, module_name, field_name, models) |
|---|
| 14 |
try: |
|---|
| 15 |
label = dict(f.field.choices)[field_val] |
|---|
| 16 |
except KeyError: |
|---|
| 17 |
raise Http404('Invalid choice value given') |
|---|
| 18 |
obj_list = m.objects(**{f.field.name: field_val}) |
|---|
| 19 |
return render_to_response('databrowse/choice_detail.html', {'model': m, 'field': f, 'value': label, 'object_list': obj_list}) |
|---|