Mercurial > personas_backend
view PersonasBackend/personas/forms.py @ 82:48d003206525
Fixed a bug that caused uploading an image to raise a KeyError in ensure_header_and_footer_are_valid() because uploaded files aren't represented in a form's cleaned_data attribute.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 13 Mar 2008 16:30:30 -0500 |
parents | a652394445e1 |
children | 5029082ee13f |
line wrap: on
line source
from django.newforms import ModelForm, ValidationError from PersonasBackend.personas import models class PersonaForm( ModelForm ): """ Form given to normal users who don't have the permission to publish Personas. """ class Meta: model = models.Persona exclude = ["owner", "status"] def clean( self ): try: form_data = dict( self.cleaned_data ) form_data.update( self.files ) models.ensure_header_and_footer_are_valid( form_data ) except ValueError, e: raise ValidationError( e.message ) return self.cleaned_data