old_contents: from crispy_forms.helper import FormHelper
  from crispy_forms.layout import Submit
  from django import forms
  from django.utils.translation import ugettext_lazy as _
  
  from .models import User
  
  
  class UserCreationForm(forms.ModelForm):
      """A form for creating new users. Includes all the required
      fields, plus a repeated password."""
      password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
      password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput)
  
      class Meta:
          model = User
          fields = ('email', 'gender', 'mobile_number', 'whatsapp_number', 'pk_number',
                    'previous_university', 'type')
  
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
          self.helper = FormHelper()
          self.helper.form_class = 'form-horizontal'
          self.helper.label_class = 'col-lg-2'
          self.helper.field_class = 'col-lg-8'
          self.helper.add_input(Submit('submit', 'Submit'))
  
      def clean_password2(self):
          # Check that the two password entries match
          password1 = self.cleaned_data.get("password1")
          password2 = self.cleaned_data.get("password2")
          if password1 and password2 and password1 != password2:
              raise forms.ValidationError("Password tidak sesuai")
          return password2
  
      def save(self, commit=True):
          # Save the provided password in hashed format
          user = super(UserCreationForm, self).save(commit=False)
          user.set_password(self.cleaned_data["password1"])
          if commit:
              user.save()
          return user
  
  
  class UserChangeForm(forms.ModelForm):
      same_number = forms.BooleanField(label=_("Copy number for whatsapp"))
  
      class Meta:
          model = User
          fields = ('email', 'gender', 'mobile_number', 'same_number',
                    'whatsapp_number', 'pk_number', 'previous_university', 'type')
  
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
          self.helper = FormHelper()
          self.helper.form_class = 'form-horizontal'
          self.helper.label_class = 'col-lg-2'
          self.helper.field_class = 'col-lg-8'
          self.helper.add_input(Submit('submit', 'Submit'))
  
new_contents: from crispy_forms.helper import FormHelper
  from crispy_forms.layout import Submit
  from django import forms
  from django.utils.translation import ugettext_lazy as _
  
  from .models import User
  
  
  class UserCreationForm(forms.ModelForm):
      """A form for creating new users. Includes all the required
      fields, plus a repeated password."""
      password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
      password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput)
      same_number = forms.BooleanField(label=_("Copy number for whatsapp"))
  
      class Meta:
          model = User
          fields = ('email', 'gender', 'mobile_number', 'same_number',
                    'whatsapp_number', 'pk_number', 'previous_university', 'type')
  
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
          self.helper = FormHelper()
          self.helper.form_class = 'form-horizontal'
          self.helper.label_class = 'col-lg-2'
          self.helper.field_class = 'col-lg-8'
          self.helper.add_input(Submit('submit', 'Submit'))
  
      def clean_password2(self):
          # Check that the two password entries match
          password1 = self.cleaned_data.get("password1")
          password2 = self.cleaned_data.get("password2")
          if password1 and password2 and password1 != password2:
              raise forms.ValidationError("Password tidak sesuai")
          return password2
  
      def save(self, commit=True):
          # Save the provided password in hashed format
          user = super(UserCreationForm, self).save(commit=False)
          user.set_password(self.cleaned_data["password1"])
          if commit:
              user.save()
          return user
  
  
  class UserChangeForm(forms.ModelForm):
      same_number = forms.BooleanField(label=_("Copy number for whatsapp"))
  
      class Meta:
          model = User
          fields = ('email', 'gender', 'mobile_number', 'same_number',
                    'whatsapp_number', 'pk_number', 'previous_university', 'type')
  
      def __init__(self, *args, **kwargs):
          super().__init__(*args, **kwargs)
          self.helper = FormHelper()
          self.helper.form_class = 'form-horizontal'
          self.helper.label_class = 'col-lg-2'
          self.helper.field_class = 'col-lg-8'
          self.helper.add_input(Submit('submit', 'Submit'))
  
subject: Copy number on registration page