5I am trying to modify a tuple in the database via a formular and I have not been able to do so since. I would like a sample code that works. Views.py


def modifier_ue(request, code):

    if request.method == 'POST':

        ue_form = UEForms(request.POST);
        if ue_form.is_valid() and 'supprimer' in request.POST:
                return HttpResponse('supprimer');

        elif ue_form.is_valid() and 'continuer' in request.POST:
            return HttpResponse('continuer');


        elif ue_form.is_valid() and 'quitter' in request.POST:
            return HttpResponse('quitter');


        else:
            return HttpResponse(ue_form.errors.as_data())


    else:
        ue      = UE.objects.get(code_ue=code);
        ue_form = UEForms(instance=ue);
        return render(request, 'fely/admin/modifier_ue.html', {'ue_form': ue_form, 'code': code});

ue_form.is_valid() always is false and "modifier_ue.html" call view "modifier_ue"

0 Answers