Closed gamesbook closed 6 years ago
It does appear that the error might be on this line:
{% get_menu request as menu %}
but I am not sure what it does or how it sources its information.
My page is called from views.py
in the app as:
return render(
request=request,
template_name='query/query_menu.html',
context={'items': items})
Further debugging into the suit code shows that it expects the AdminSite.each_context
, which in turn contains available_apps
- see:
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#adminsite-methods
So I have altered my render in the view to:
return render(
request=request,
template_name='query/query_menu.html',
context=dict(
admin.site.each_context(request),
items=items)
)
)
@gamesbook Yes, each_context is required, see demo here too: http://v2.djangosuit.com/admin/custom/ https://github.com/darklow/django-suit/blob/v2/demo/demo/views.py#L7
Thanks for the redirect to this report: I've changed my render statement to
return render(
request=request,
template_name='admin/poetry/document/change_list.html',
context=dict(admin.site.each_context(request), items=Items)
and included a
from django.contrib import admin
at the head of my views.py
but it's failing to find items
even when I include
from .models import *
I think I'm getting out of my depth - can you help please?
Have you tried using dummy data? e.g.
items='dummy data'
I am not sure that passing in that class name (Items
) is at all useful?
And, finally, from X import *
is considered poor programming practice in Python!
If this is a bug please specify versions you're using first.
Django version: 1.11.9 Django Suit version: 2.0a1 Python version: 3.4.3
Issue:
I'd like to create a "blank" admin page (content to be filled dynamically but not a normal admin form or admin list) for one of my apps. It should obviously have the normal (customised) header, menu and footer. However when I try with even a minimal template:
I get this error: