﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20086	UserCreationForm does not support custom models.	efrinut@…	nobody	"Hey,

It's my first ticket :)

I've found out that UserCreationForm() located in django\contrib\auth\forms.py does not support custom models.

In some places there should be used get_user_model() in my opinion.



{{{
    class Meta:
        model = User # Should be get_user_model()
        fields = (""username"",)

    def clean_username(self):
        # Since User.username is unique, this check is redundant,
        # but it sets a nicer error message than the ORM. See #13147.
        username = self.cleaned_data[""username""]
        try:
            User._default_manager.get(username=username) #Should be get_user_model()
        except User.DoesNotExist:
            return username
        raise forms.ValidationError(self.error_messages['duplicate_username'])



}}}
"	Bug	closed	contrib.auth	1.5	Normal	fixed			Accepted	1	0	0	0	0	0
