Hi,
I have a model containing:
class Book(models.Model):
title = models.CharField(max_length=128)
price = models.DecimalField(max_digits=8, decimal_places=2,
help_text='Please enter the price in $')
summary = models.TextField(blank=True)
and I adjust the textarea size using admin.py:
class BookModelForm(forms.ModelForm):
title = forms.CharField(widget=forms.TextInput(attrs=
{'size':'80'}))
summary = forms.CharField(widget=forms.widgets.Textarea(attrs=
{'rows':30, 'cols':100}))
class Meta:
Book
Now notice the model option "blank=True" for the summary field. When I
have an admin form and I enter the data but leave the "summary" field
empty I get a validation error, stating "This field is required".
However when I ommit the the summary entry in the admin class
BookModelForm like this:
class BookModelForm(forms.ModelForm):
title = forms.CharField(widget=forms.TextInput(attrs=
{'size':'80'}))
class Meta:
Book
I am not the getting the validation error. Nothing changes in the
actual model. Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---