from django import forms

class ContactForm(forms.Form):
    name = forms.CharField(widget=forms.TextInput(attrs={'placeholder': 'Username'}),
                           label='Duck',
                           required=True,
                           help_text='100 characters max.',)
    message = forms.CharField(widget=forms.Textarea,
                             error_messages={'required':'Cuak Cuak im a duck'})
    password = forms.CharField(widget=forms.PasswordInput)
    password_confirm = forms.CharField(widget=forms.PasswordInput)
 
    def clean(self):
        cleaned_data = super(ContactForm, self).clean()
        cc_1 = cleaned_data.get("password")
        cc_2 = cleaned_data.get("password_confirm")
        if cc_2 != cc_1:
            self._errors['password'] = [u'Passwords must match.']
            self._errors['password_confirm'] = [u'Passwords must match.']
            raise forms.ValidationError(
                    "Did not send for 'help' in the subject despite "
                    "CC'ing yourself."
                )
    

    def send_email(self):
        print("/*/*/*/*/*" + self.cleaned_data['name'])