How do you get your template/view to recognize whether or not a logged in user is a super user or not?
There are certain buttons on my forms (in the template) that I want completely hidden if the user is not a super-user
How would you go about doing that?
Check out
is_superuseron theUserobject:EDIT: after @mustafa-0x comments
The above assumes that you have
django.core.context_processors.requestincluded in yourTEMPLATE_CONTEXT_PROCESSORSsetting which isn’t the default.The default setting for
TEMPLATE_CONTEXT_PROCESSORS:already includes the
django.contrib.auth.context_processors.auth(and notably doesn’t include therequestcontext processor) meaning that in most cases you will already have access to{{ user }}without the need to add it to your context via the view, or enable therequestcontext processor to access the user as above via{{ request.user }}