Form not taking my input...
Howdy,
I am still new to Django and have been working with forms.
Currently I a getting an error that says a field can't be NULL, even
though I have entered data into it. Weird!
Error:
IntegrityError at /save/
winerater_wine.alcohol may not be NULL
Request Method: POST
Request URL: http://localhost:1100/save/
Exception Type: IntegrityError
Exception Value:
winerater_wine.alcohol may not be NULL
Exception Location: /Library/Python/2.6/site-packages/django/db/
models/query.py in get_or_create, line 343
Python Executable: /usr/bin/python
Python Version: 2.6.1
Here the code for model/form issue:
From my forms.py file:
class WineAddForm(forms.Form):
wine_name = forms.CharField(
label = u'Wine Name:',
widget=forms.TextInput(attrs={'size': 30})
)
wine_kind = forms.ChoiceField(choices=WINE_KIND)
wine_year = forms.CharField(widget=forms.Select(choices=WINE_YEAR),
required=False)
alcohol = forms.DecimalField(max_digits=3,
decimal_places=1,
widget=forms.TextInput(attrs={"size": 5}))
class Wine(models.Model):
wine_name = models.CharField(max_length=60, unique=True)
wine_kind = models.CharField(max_length=9)
varietal = models.CharField(max_length=25)
wine_year = models.DateField(max_length=4, null=True)
alcohol = models.FloatField()
I apologize in advance if this code is completely bass-ackwards, but
you have to start some where... I did search on this but wasn't able
to resolve it.
Thanks in advance for any help!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home