Hello,

I have got two checkboxes in a Form on Django 3.1, with which everything
works fine, but unchecking them.

I use a class derived from UpdateView and in its post() method I check
for if my form has changed. This works fine for an initial empty form
and checking form.has_changed(); after then handling the change and
calling get() with the objects id in the Browser. I get the Form back
with checked checkboxes. The values in the database are fine as well.

So now I want to test with unchecking those checkboxes and it does not
work. Form.has_changed() == False and Form.changed_data is empty. While
the correct values are in Form.cleaned_data(). But my code does not
detect these values because I check for Form.has_changed().

Am I understanding something wrong here or do I have to check if there
is a difference from the values I get in Form.cleaned_data to what my
current state in the database is myself?

I am happy to show the code. But I thought I'd ask about it in general
before posting lots of code.

---
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a 
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
[email protected]

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/13e0719e-8d06-e37c-b07e-1c6deb1f84e6%40punkt.de.

Reply via email to