Mercurial > personas_backend
diff personasbackend/personas/forms.py @ 149:98257bc9841e
We no longer require users to manually click the 'agree to terms' button after they've initially created their persona.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 04 Apr 2008 12:01:44 -0700 |
parents | 9bcc77e37c19 |
children | 052bf8a07b76 |
line wrap: on
line diff
--- a/personasbackend/personas/forms.py Fri Apr 04 11:46:40 2008 -0700 +++ b/personasbackend/personas/forms.py Fri Apr 04 12:01:44 2008 -0700 @@ -1,7 +1,7 @@ import django.newforms as forms from personasbackend.personas import models -class PersonaForm( forms.ModelForm ): +class BasePersonaForm( forms.ModelForm ): """ Form given to normal users who don't have the permission to publish Personas. @@ -11,19 +11,6 @@ model = models.Persona exclude = ["owner", "date_published", "popularity", "status"] - agree_to_terms = forms.BooleanField( - label = "I agree to the terms of use.", - # TODO: setting required to True doesn't seem to have any effect, - # but the Django docs say it should ensure that the checkbox - # is filled out. - required = True, - help_text = ("Terms of use: I agree that Mozilla is providing " - "a service by hosting the " - "content I am submitting, and that they are in no " - "way responsible for any damages that occur as " - "a result of hosting said content.") - ) - def _color_cleaner( self, field ): models.ensure_color_is_valid( self.cleaned_data[field], @@ -37,6 +24,23 @@ def clean_accent_color( self ): return self._color_cleaner( "accent_color" ) +class EditPersonaForm( BasePersonaForm ): + pass + +class NewPersonaForm( BasePersonaForm ): + agree_to_terms = forms.BooleanField( + label = "I agree to the terms of use.", + # TODO: setting required to True doesn't seem to have any effect, + # but the Django docs say it should ensure that the checkbox + # is filled out. + required = True, + help_text = ("Terms of use: I agree that Mozilla is providing " + "a service by hosting the " + "content I am submitting, and that they are in no " + "way responsible for any damages that occur as " + "a result of hosting said content.") + ) + def clean( self ): if not self.cleaned_data["agree_to_terms"]: raise forms.ValidationError(