Right now, the ORM gets super duper unhappy when attempting to reference the UserSettings model instance foreign keyed to a User model instance during authentication.
This appears to surface in the save_user_settings receiver attached to the User model:
@receiver(post_save, sender=User)
def save_user_settings(sender, instance, **kwargs):
instance.profile_settings.save()
Testing on QA indicates something like this may be sufficient:
@receiver(post_save, sender=User)
def save_user_settings(sender, instance, **kwargs):
try:
instance.profile_settings.save()
except UserSettings.DoesNotExist:
settings = UserSettings.objects.create(user=instance)
settings.initialize_profile_fields()
But we should ensure all possible edge cases where profile fields can be referenced are similarly equipped to handle a missing UserSettings instance.
Right now, the ORM gets super duper unhappy when attempting to reference the
UserSettingsmodel instance foreign keyed to aUsermodel instance during authentication.This appears to surface in the
save_user_settingsreceiver attached to theUsermodel:Testing on QA indicates something like this may be sufficient:
But we should ensure all possible edge cases where profile fields can be referenced are similarly equipped to handle a missing
UserSettingsinstance.