[Answer]-Extended User Model – Conditional URL Redirect

1👍

Get the current user from the request.user:

request.user.groups.filter(name__in["Group1"])

You may also utilize exists():

Returns True if the QuerySet contains any results, and False if not.
This tries to perform the query in the simplest and fastest way
possible, but it does execute nearly the same query as a normal
QuerySet query.

if request.user.groups.filter(name__in["Group1"]).exists():
👤alecxe

Leave a comment