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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -