Ticket #28608: patch.diff

File patch.diff, 2.2 KB (added by Rômulo Collopy, 7 years ago)

patch

  • django/contrib/auth/forms.py

    diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
    index a5de5bf650..87f916dae4 100644
    a b class UserCreationForm(forms.ModelForm):  
    8383    )
    8484
    8585    class Meta:
    86         model = User
     86        model = UserModel
    8787        fields = ("username",)
    8888        field_classes = {'username': UsernameField}
    8989
    class UserChangeForm(forms.ModelForm):  
    132132    )
    133133
    134134    class Meta:
    135         model = User
     135        model = UserModel
    136136        fields = '__all__'
    137137        field_classes = {'username': UsernameField}
    138138
  • docs/topics/auth/customizing.txt

    diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt
    index 84f0782eb5..382a480717 100644
    a b The following forms are compatible with any subclass of  
    840840* :class:`~django.contrib.auth.forms.SetPasswordForm`
    841841* :class:`~django.contrib.auth.forms.PasswordChangeForm`
    842842* :class:`~django.contrib.auth.forms.AdminPasswordChangeForm`
     843* :class:`~django.contrib.auth.forms.UserCreationForm`
     844* :class:`~django.contrib.auth.forms.UserChangeForm`
     845
    843846
    844847The following forms make assumptions about the user model and can be used as-is
    845848if those assumptions are met:
    if those assumptions are met:  
    850853  default) that can be used to identify the user and a boolean field named
    851854  ``is_active`` to prevent password resets for inactive users.
    852855
    853 Finally, the following forms are tied to
    854 :class:`~django.contrib.auth.models.User` and need to be rewritten or extended
    855 to work with a custom user model:
    856 
    857 * :class:`~django.contrib.auth.forms.UserCreationForm`
    858 * :class:`~django.contrib.auth.forms.UserChangeForm`
    859 
    860 If your custom user model is a simple subclass of ``AbstractUser``, then you
    861 can extend these forms in this manner::
    862 
    863     from django.contrib.auth.forms import UserCreationForm
    864     from myapp.models import CustomUser
    865 
    866     class CustomUserCreationForm(UserCreationForm):
    867 
    868         class Meta(UserCreationForm.Meta):
    869             model = CustomUser
    870             fields = UserCreationForm.Meta.fields + ('custom_field',)
    871856
    872857Custom users and :mod:`django.contrib.admin`
    873858--------------------------------------------
Back to Top