sorry this didnt work, when i try this
if created:
instance.profile = Profile.objects.create(user=instance)
instance.save()
i couldnt even register any user
On Mon, Jul 27, 2020 at 2:24 AM Fernando Hernandez <[email protected]>
wrote:
> I think the issue is here instance.profile will be None first time the
> CustomUser is created, you need to assign the created Profile to the
> instance and then save the user
> [image: image.png]
> try this
> if created:
> instance.profile = Profile.objects.create(user=instance)
> instance.save()
>
>
>
>
> On Sun, Jul 26, 2020 at 2:00 PM ola neat <[email protected]> wrote:
>
>> good day, i'm working on a project that allow user create their profile
>> after they have signup, thereby having 2 seperate model, User and Profile
>> but i'm getting a not null constraint error, below is they screenshot of my
>> code and err msg
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHLKn73K5hEjn%3DzeoQQtaZBOTj4J6f4LH45V1xOKSE6E%3DoOeFQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAHLKn73K5hEjn%3DzeoQQtaZBOTj4J6f4LH45V1xOKSE6E%3DoOeFQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACmeZJz1cGJT4Tzqy6QT-ncXJC1TUExEQi7y%2BgDpsfh88bO1WA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACmeZJz1cGJT4Tzqy6QT-ncXJC1TUExEQi7y%2BgDpsfh88bO1WA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAHLKn70upQjNtDC7eYgMZfvE0emZ9vhRYNVtiR%3DqkXB3MbU-jw%40mail.gmail.com.