Tuesday, April 21, 2020

Re: save() got an unexpected keyword argument 'force_insert'

What do you mean ? 

On Tuesday, April 21, 2020 at 11:13:16 PM UTC-4, Motaz Hejaze wrote:
did you define managers ?

On Wed, Apr 22, 2020 at 5:06 AM Ahmed Khairy <ahmed.he...@gmail.com> wrote:
Model Form 

UserCreationForm

On Tuesday, April 21, 2020 at 11:02:13 PM UTC-4, Motaz Hejaze wrote:
what kind of forms is this ? regular form or model form ?


On Wed, Apr 22, 2020 at 4:57 AM Ahmed Khairy <ahmed.he...@gmail.com> wrote:
Hi all, 

Got this unexpected error all of a sudden, how to fix it. 

save() got an unexpected keyword argument 'force_insert'


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')
            return redirect('login')
    else:
        form = UserRegisterForm()
    return render(request, 'register.html', {'form': form})

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/be6de004-4a69-4346-8a12-99eced8d76a3%40googlegroups.com.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a164104-3cab-4d97-a6ac-47b9a3ed98dd%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/affd82c8-1b8c-46a0-85c0-a3a5c6939abe%40googlegroups.com.

No comments:

Post a Comment