1

I am new to django and have recently started working on it. I have made a django application and I am able to make the user log into it and display the group that he is a member of using:

request.user.groups.all()

Now, I want to display those groups, in which he is not a member, on a web page, upon his login, so that he can click on a link associated with that group and get himself registered. Please help.

1 Answers1

1

Similar question: Django in / not in query So it should be like this:

Group.objects.exclude(id__in=request.user.groups.all().values_list('id', flat=True))
Community
  • 1
  • 1
ambi
  • 1,256
  • 11
  • 16