cleaned_data() doesn't have some of the entered data
Posted
by SC Ghost
on Stack Overflow
See other posts from Stack Overflow
or by SC Ghost
Published on 2010-06-08T15:12:29Z
Indexed on
2010/06/08
19:02 UTC
Read the original article
Hit count: 312
I have a simple form for a user to enter in Name (CharField), Age(IntegerField), and Sex(ChoiceField). However the data that is taken from the Sex choice field is not showing up in my cleaned_data(). Using a debugger, I can clearly see that the data is being received in the correct format but as soon as I do form.cleaned_data() all sign of my choice field data is gone. Any help would be greatly appreciated. Here is the relative code:
class InformationForm(forms.Form):
Name = forms.CharField()
Age = forms.IntegerField()
Sex = forms.ChoiceField(SEX_CHOICES, required=True)
def get_information(request, username):
if request.method == 'GET':
form = InformationForm()
else:
form = RelativeForm(request.POST)
if form.is_valid():
relative_data = form.cleaned_data
© Stack Overflow or respective owner