1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 16:02:25 +00:00

profile is first created via signal.

This commit is contained in:
Pierre-antoine Comby 2020-03-09 18:08:37 +01:00
parent 3990009400
commit 0de2c18bec

View File

@ -49,10 +49,10 @@ class UserCreateView(CreateView):
def form_valid(self, form): def form_valid(self, form):
profile_form = ProfileForm(self.request.POST) profile_form = ProfileForm(self.request.POST)
if form.is_valid() and profile_form.is_valid(): if form.is_valid() and profile_form.is_valid():
user = form.save() user = form.save(commit=False)
profile = profile_form.save(commit=False) user.profile = profile_form.save(commit=False)
profile.user = user user.save()
profile.save() user.profile.save()
return super().form_valid(form) return super().form_valid(form)