Hi!
Have you instanced first de form?
Maybe this code from djano help you

from django.http import HttpResponseRedirectfrom django.shortcuts import render
from .forms import NameForm
def get_name(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = NameForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            # ...
            # redirect to a new URL:
            return HttpResponseRedirect('/thanks/')

    # if a GET (or any other method) we'll create a blank form
    else:
        form = NameForm()

    return render(request, 'name.html', {'form': form})


Maybe you can check has_changed() after  form=
Nameofyourforminformspy(request.POST) ?
good luck


https://docs.djangoproject.com/en/2.2/topics/forms/
https://docs.djangoproject.com/en/2.2/topics/forms/formsets/

Missatge de Mei B <lidokawaiib...@gmail.com> del dia dt., 11 de juny 2019 a
les 4:33:

>        if request.method == "POST":
>             formset = forms.Formset(data=request.POST, initial=initial)
>             if not formset.has_changed(): #has_changed always returns
> true!
>                 msg = "No changes detected."
>
>             if formset.has_changed() and formset.is_valid()
>                 do stuff...
>         else:
>             formset = forms.Formset(initial=initial)
>             formset_get = formset
>
> What am i doing wrong?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/23af35da-2f85-4512-9842-6b6811f3988b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/23af35da-2f85-4512-9842-6b6811f3988b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK-JoTQpoiRmDHMxhGXLDN6ckK6XFNETRukWZGtVRaXEPn6T4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to