#9816: ModelForm with only FileField or ImageField can not pass validation
-------------------------------+--------------------------------------------
Reporter: ogunes | Owner: nobody
Status: new | Milestone: 1.1
Component: Forms | Version: 1.0
Resolution: | Keywords: ModelForm ImageField validation
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Comment (by peterbe):
I can not reproduce it either. Here's what I did
{{{
class MyModel(models.Model):
a = models.FileField(upload_to='.')
b = models.CharField(max_length=123)
class FileOnlyForm(forms.ModelForm):
class Meta:
model = MyModel
fields = ['a']
}}}
And a view that uses this modelform
{{{
def fileupload(request):
if request.method == "POST":
form = FileOnlyForm(request.POST, request.FILES)
print form.is_valid()
else:
form = FileOnlyForm()
return render_to_response('fileupload.html', locals(),
context_instance=RequestContext(request))
}}}
With that I was able to conclude that it works. It does NOT matter if
there's only one (file)field or more.
--
Ticket URL: <http://code.djangoproject.com/ticket/9816#comment:5>
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
-~----------~----~----~----~------~----~------~--~---