Mango /

from django import forms

class CommentForm(forms.Form):
    author_name = forms.CharField(label='Name', max_length=100)
    author_email = forms.EmailField(label='E-mail', max_length=100)
    author_url = forms.URLField(label='Website', max_length=100, required=False)
    message = forms.CharField(label='Comment')
    subscribe = forms.BooleanField(label='Notify me of follow-up comments via e-mail', required=False)

    def clean_author_name(self):
        return self.cleaned_data.get('author_name', '').strip()

    def clean_author_email(self):
        return self.cleaned_data.get('author_email', '').strip().lower()

    def clean_author_url(self):
        return self.cleaned_data.get('author_url', '').strip()

    def clean_message(self):
        return self.cleaned_data.get('message', '').strip().replace('\r\n', '\n')

class ContactForm(forms.Form):
    sender_name = forms.CharField(label='Name', initial='your name', max_length=100)
    sender_email = forms.EmailField(label='E-mail', initial='your e-mail address', max_length=100)
    subject = forms.CharField(label='Subject', max_length=100, required=False)
    message = forms.CharField(label='Message')
    cc_sender = forms.BooleanField(label='Send me a copy of this message', required=False)

    def clean_sender_name(self):
        return self.cleaned_data.get('sender_name', '').strip()

    def clean_sender_email(self):
        return self.cleaned_data.get('sender_email', '').strip().lower()

    def clean_subject(self):
        return self.cleaned_data.get('subject', '').strip()

    def clean_message(self):
        return self.cleaned_data.get('message', '').strip().replace('\r\n', '\n')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.