I'm looking to add a User to a group only if a field of this User is specified as 'True' once the User is created. Every User that is created would have a 'UserProfile' associated with it. Would this be the correct way to implement such a thing?
models.py:
def add_group(sender, instance, created, **kwargs):if created:sender = UserProfileif sender.is_in_group:from django.contrib.auth.models import Groupg = Group.objects.get(name='Some Group')g.user_set.add(sender)post_save.connect(add_group, sender=UserProfile)
Thanks in advance!