Bugfix for Django 1.1/dev, whose release broke an ugly hack I used
parent
cf59e49b39
commit
ace257c299
|
@ -28,10 +28,12 @@ class QuestionAdmin(admin.ModelAdmin):
|
|||
ordering = ['questionset__questionnaire', 'questionset', 'number']
|
||||
inlines = [ChoiceInline]
|
||||
|
||||
def queryset(self, request):
|
||||
# we have a custom template
|
||||
qs = Questionnaire.objects.all().order_by('name')
|
||||
return qs
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
"Hack to have Questionnaire list accessible for custom changelist template"
|
||||
if not extra_context:
|
||||
extra_context = {}
|
||||
extra_context['questionnaires'] = Questionnaire.objects.all().order_by('name')
|
||||
return super(QuestionAdmin, self).changelist_view(request, extra_context)
|
||||
|
||||
class QuestionnaireAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
|
|
|
@ -16,7 +16,7 @@ function togglehide(id) {
|
|||
return false;
|
||||
}
|
||||
</script>
|
||||
{% for questionnaire in cl.get_query_set %}
|
||||
{% for questionnaire in questionnaires %}
|
||||
|
||||
<H2 onClick="togglehide('{{ questionnaire.id }}');">
|
||||
<span id="qhead-{{ questionnaire.id }}">↑</span>{{ questionnaire.name }}
|
||||
|
|
Loading…
Reference in New Issue