On Fri, Aug 22, 2008 at 10:22 AM, Michael Sanders <[EMAIL PROTECTED]> wrote: > Is this a consequence of http://code.djangoproject.com/changeset/8348 > or should I be doing something else to enable this validation? (I have > PIL installed). Would it be preferable to use a Django form for the > image upload & would it make any difference?
You could test that fairly easily by rolling back to a revision prior to r8348 to see if it works properly there, but I doubt it would. Model-level validation didn't really work before that revision either, so your example view was never triggering anything to even check whether it's an image or not. You should really be using forms here, even though you're not submitting them through the normal channels. This would allow you to use form-level validations, which are designed precisely for these types of situations. Just create a form (probably a ModelForm) that matches whatever you intend to post back to the server, and pass request.POST and request.FILES into that and use its .is_valid() method to force the proper validations to run. -Gul --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---