I created a custom group in Django\'s admin site.
In my code, I want to check if a user is in this group. How do I do that?
You just need one line:
from django.contrib.auth.decorators import user_passes_test @user_passes_test(lambda u: u.groups.filter(name='companyGroup').exists()) def you_view(): return HttpResponse("Since you're logged in, you can see this text!")