Django Admin Create Form Inline Onetoone
I have the following model: from django.db import models class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) last_password_reset = mo
Solution 1:
Turns out I needed to remove some signals I had written for automatic profile creation:
# Create a profile for new users
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_user_profile(sender, instance=None, created=False, **kwargs):
if created:
Profile.objects.get_or_create(user=instance)
# Update profile on user change
@receiver(post_save, sender=User)
def save_user_profile(sender, instance=None, created=False, **kwargs):
instance.profile.save()
Post a Comment for "Django Admin Create Form Inline Onetoone"