upload/forms.py
author Shantanu <shantanu@fossee.in>
Thu, 03 Sep 2009 17:31:12 +0530
changeset 17 08a47999f316
parent 4 ac11fee16880
child 18 07408d1ced76
permissions -rw-r--r--
Added submissions page.

from django import forms

from spoken_tut.upload.models import Participant

class ParticipantForm(forms.ModelForm):
    def clean(self):
        """Cleaner for validating Other language field.
        """
        cleaned_data = self.cleaned_data
        lang = cleaned_data['language']
        other_lang = cleaned_data['other_lang']
        accept = cleaned_data['accept']
        if lang == 'Other' and not other_lang:
            raise forms.ValidationError('Please fill in the other language field.')
        if accept:
            raise forms.ValidationError('You need to accept the terms and condition for uploading the data.')

	class Meta:
		model = Participant