﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9142	Validation shouldn't be coupled with validation...	italomaia	nobody	"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
}}}

    "		closed	Forms	1.0-alpha-2		invalid	form validation decouple		Unreviewed	0	0	0	0	0	0
