About Checking Permissions with django-guardian in a Template Generically
Django Guardian template tag {% get_obj_perms %}
returns a list of allowed permission codenames, such as "change_song" or "change_video". If your template accepts multiple types of objects, it might seem tricky to check if "change_thatthing" is in the list of permissions. But you can still do it by checking for the existence of "change_" in the list, joined to a string:
1 2 3 4 5 6 7 8 9 |
|
Tips and Tricks Programming Permissions Django 4.2 Django 3.2 Django 2.2 django-guardian
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.