Bugfix for Django 1.1/dev, whose release broke an ugly hack I used

EmailTemplateFixes
Robert M. Thomson 2009-09-11 15:16:50 +02:00
parent cf59e49b39
commit ace257c299
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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 }}">&uarr;</span>{{ questionnaire.name }}