<s> __author__ = '<STR_LIT>' <EOL> from django import forms <EOL> from django . contrib . auth . models import User <EOL> from rango . models import Page , Category , UserProfile <EOL> class CategoryForm ( forms . ModelForm ) : <EOL> name = forms . CharField ( max_length = <NUM_LIT> , help_text = "<STR_LIT>" ) <EOL> views = forms . IntegerField ( widget = forms . HiddenInput ( ) , initial = <NUM_LIT:0> ) <EOL> likes = forms . IntegerField ( widget = forms . HiddenInput ( ) , initial = <NUM_LIT:0> ) <EOL> slug = forms . CharField ( widget = forms . HiddenInput ( ) , required = False ) <EOL> class Meta : <EOL> model = Category <EOL> fields = ( '<STR_LIT:name>' , ) <EOL> class PageForm ( forms . ModelForm ) : <EOL> title = forms . CharField ( max_length = <NUM_LIT> , help_text = "<STR_LIT>" ) <EOL> url = forms . URLField ( max_length = <NUM_LIT:200> , help_text = "<STR_LIT>" ) <EOL> views = forms . IntegerField ( widget = forms . HiddenInput ( ) , initial = <NUM_LIT:0> ) <EOL> def clean ( self ) : <EOL> cleaned_data = self . cleaned_data <EOL> url = cleaned_data . get ( '<STR_LIT:url>' ) <EOL> if url and not url . startswith ( '<STR_LIT>' ) : <EOL> url = '<STR_LIT>' + url <EOL> cleaned_data [ '<STR_LIT:url>' ] = url <EOL> return cleaned_data <EOL> class Meta : <EOL> model = Page <EOL> exclude = ( '<STR_LIT>' , ) <EOL> class UserForm ( forms . ModelForm ) : <EOL> password = forms . CharField ( widget = forms . PasswordInput ( ) ) <EOL> class Meta : <EOL> model = User <EOL> fields = ( '<STR_LIT:username>' , '<STR_LIT:email>' , '<STR_LIT:password>' ) <EOL> class UserProfileForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> model = UserProfile <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' ) </s>
