Using Django, how can I detect an admin in my javascript? -


i have functions in javascript not available normal users, , admins/staff. ideally can create boolean variable true/false depending on whether request user staff or not, how set boolean?

note: i'm not trying disable them security, user experience.

you can try use yesno filter inside js, example:

var is_staff = {{ request.user.is_staff|yesno:"true,false" }} 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -