I have a Django ModelForm (below) that I include a customized html snipped.
And I am using django-crispy forms.

Added the clean() method to help explain my problem.

```python
class ProfileForm(forms.ModelForm):
    self.helper.layout = Layout(
    Fieldset(
        "Triage {{ settings.triage }}",
        HTML('{% include "snippets/problem_choice.html" %}'),
    ),
)

def clean(self):
    unclean = self.data
    super().clean()
    data = self.cleaned_data
```

The simplified `problem_choice.html` snippet is a table of radio buttons 
and checkboxes.
```html
<tr>
<td>Problem A</td>
<td><input type="radio" name="choice_1" value="1"></td>
<td><input type="radio" name="choice_2" value="1"></td>
<td><input type="radio" name="choice_3" value="1"></td>
<td><input type="checkbox" name="willing_to_judge" value="1"></td>
<td><input type="checkbox" name="not_willing_to_judge" value="1">1</td>
<td><input type="checkbox" name="not_willing_to_judge" value="x">x</td>
<td><input type="checkbox" name="not_willing_to_judge" value="y">y</td>
<td><input type="checkbox" name="not_willing_to_judge" value="z">z</td>
</tr>
```
I put a breakpoint at the `unclean = self.data()` in the `clean()` method. 
I expect if I click (check) the not_willing_to_judge checkboxes 1, x, y, 
and z I'd see a list in unclean data, [1, x, y, z] but I only see 
`not_willing_to_judge: 
'z'`

If I click (check) 1, x, y, and leave z unchecked, I get `not_willing_to_judge: 
'y'`

Does anyone see the problem?

Can someone confirm that I should be getting a list of the checked items in 
the unclean data?

Thanks.


-- 
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/a0f119bc-156d-412d-a088-cdd9c7b6a6b8n%40googlegroups.com.

Reply via email to