text: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  from django import forms
  from django.contrib.auth.models import User
  from django.contrib.auth.forms import UserCreationForm
  
  from webproject import models
  
  
  class UserCreateEmailForm(UserCreationForm):
      email = forms.EmailField(required=True)
  
      class Meta:
          model = User
          fields = ("username", "email", "password1", "password2")
  
      def save(self, commit=True):
          user = super(UserCreateEmailForm, self).save(commit=False)
          user.email = self.cleaned_data["email"]
          if commit:
              user.save()
          return user
  
  
  class ProfileForm(forms.ModelForm):
  
      class Meta:
          model = models.Profile
          fields = ["affiliation", "note"]
  
  