15👍
✅
There is a defaults
argument you can pass to get_or_create
to populate this data for newly created objects which are not used in the filtering:
defaults = {'added_by': request.user}
obj, created = SocialGroupMembers.objects.get_or_create(
social_group=social_group, profile=profile, defaults=defaults)
https://docs.djangoproject.com/en/1.4/ref/models/querysets/#get-or-create
Source:stackexchange.com