I created a custom auth permission in django via admin site, and i added that permission to a user (not a group), now i want to ask if the request user in a template has it but nothing works.It's not a duplicate, i already checked similar questions and none of this work:
{% if perms.auth.add_something %}
{% if 'auth.add_something' in request.user.get_all_permissions %}
{% if request.user.has_perm('add_something') %}
I add my view:
class NotificationSelectView(View):
template = 'myapp/notification_read.html'
def get(self, request, *args, **kwargs):
t = tree(request)
req_var_list = []
analist = notifications_list(request.user)
level = LevelProcess.objects.get(
level_hierarchical = 3
)
subprocess= Process.objects.filter(level = level)
user = request.user
t.update({
'subprocess': subprocess,
'analist':analist,
})
return render(request, self.template, t)
The idea it's to make it inside template, not to use more code in views. Any ideas ?, thanks in advance.