I am extending change_list.html and I need to output a variable defined in settings.py.
How do I pass that particular variable into the custom admin template context?
class MyModelAdmin(admin.ModelAdmin):
...
def changelist_view(self, request, extra_context=None):
extra_context = extra_context or {}
extra_context['some_var'] = 'This is what I want to show'
return super(MyModelAdmin, self).changelist_view(request, extra_context=extra_context)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.