Thursday, 5 November 2020

Django admin add context to users and groups

I am in a process of customizing django's admin page and hit a brick wall at passing some variable in add, change, change_list of the admin's user and group template.

I have passed a variable in index or any other page via:

#admin.py

class MyAdminSite(AdminSite):
    def index(self, request, extra_context=None):
        extra_context = extra_context or {}
        extra_context['Sched_today'] = mycustomlink
        return super(MyAdminSite, self).index(request, extra_context=extra_context)

or

class MyModelAdmin (admin.ModelAdmin):
    def change_view(self, request, object_id, form_url='', extra_context=None):
    ....

But how can I pass variable to the groups and user templates(Authentication and Authorization), their changelist_view, change_view, oradd_view?



from Django admin add context to users and groups

No comments:

Post a Comment