Something went wrong with the signals. Paste your signals.py file.

On Wed, Feb 23, 2022, 10:52 AM 'Delvin Alexander' via Django users <
django-users@googlegroups.com> wrote:

> Hello Everyone,
>
> I am having trouble saving a new profile, and user when they are created.
> Upon creating a new user and profile, i get this:
>
> "TypeError: Profile.save() got an unexpected keyword argument
> 'force_insert'"
>
> Would anyone know why this is popping up for me????
>
>
> Here is my work for that particular page as well.
>
> from django.shortcuts import render, redirect
> from django.contrib import messages
> from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
> from django.contrib.auth.decorators import login_required
>
>
> def register(request):
>     if request.method == 'POST':
>         form = UserRegisterForm(request.POST)
>         if form.is_valid():
>             form.save()
>             username = form.cleaned_data.get('username')
>             messages.success(request, f'Your Account has been created you
> are now able to log in {username}!')
>             return redirect('login')
>     else:
>         form = UserRegisterForm()
>     return render(request, 'users/register.html', {'form': form})
>
> @login_required
> def profile(request):
>     if request.method == 'POST':
>         u_form = UserUpdateForm(request.POST, instance=request.user)
>         p_form = ProfileUpdateForm(request.POST, request.FILES,
> instance=request.user.profile)
>         if u_form.is_valid() and p_form.is_valid():
>             u_form.save()
>             p_form.save()
>             messages.success(request, f'Your Account has been updated!')
>             return redirect('profile')
>     else:
>         u_form = UserUpdateForm(instance=request.user)
>         p_form = ProfileUpdateForm(instance=request.user.profile)
>
>     context = {
>         'u_form': u_form,
>         'p_form': p_form,
>     }
>
>     return render(request, 'users/profile.html', context)
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/39c57e72-9e09-403e-97db-562ef943db4an%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/39c57e72-9e09-403e-97db-562ef943db4an%40googlegroups.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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJY8mfyGCYeL1xFxsQ-ZtuyxkEdS_gGAYbfvwSPYG7BbusRPww%40mail.gmail.com.

Reply via email to