#9142: Validation shouldn't be coupled with validation...
--------------------------------------+-------------------------------------
Reporter: italomaia | Owner: nobody
Status: new | Milestone: post-1.0
Component: Forms | Version: 1.0-alpha-2
Keywords: form validation decouple | Stage: Unreviewed
Has_patch: 0 |
--------------------------------------+-------------------------------------
Well, very simple. If i have a ModelForm and i want to change a fields
widget, i got to do as follows :
{{{
class MyForm(forms.ModelForm):
my_field = forms.SomeField(widget=my_widget)
class Meta:
model = my_model
}}}
Well, when i do that, part of the form's validation goes away! Let's see a
actual example:
{{{
class MyModel(models.Model):
image = models.ImageField(uploat_to="some/path")
class MyForm(forms.ModelForm):
image = forms.SomeField(widget=SimpleFileWidget)
class Meta:
model = MyModel
}}}
Well, using MyForm now will not validate if image is actually a image.
That seems just wrong, to me.
Something like this would be nicier:
{{{
class MyModel(models.Model):
image = models.ImageField(uploat_to="some/path")
class MyForm(forms.ModelForm):
image = forms.SomeField(widget=SimpleFileWidget,
validation=forms.ImageValidation)
class Meta:
model = MyModel
or:
class MyForm(forms.ModelForm):
image = forms.SomeField(widget=SimpleFileWidget,
forms.get_validation(MyModel, "image")) # or something similar.
class Meta:
model = MyModel
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/9142>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---