AUTH_USER_MODEL refers to model .. that has not been installed and created AbstractUser models not able to login

前端 未结 4 780
盖世英雄少女心
盖世英雄少女心 2020-12-15 03:43

AUTH_USER_MODEL error solved in EDIT3. Passwords still will not save on user creation via form.

I\'m using Django 1.5 playing around wi

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 04:15

    Ok there were three issues here for me, so I'm going to address all of them since I am pretty sure the first two will come up for someone else.

    • Manager isn't available; User has been swapped for 'poker.PokerUser'

    This was due to using but not recreating the UserCreationForm. When using custom models in 1.5, some model forms are available out of the box but this one must be recreated. See here for the docs.

    • The Manager isn't available; User has been swapped for 'poker.PokerUser'

    While I had AUTH_USER_MODEL = 'poker.PokerUser' set in my settings.py, I was calling get_user_model() from the poker.models location. You must call get_user_model() from a different location. Moving my form to registration.forms and calling get_user_model() from there worked correctly.

    • New users not saving

    This was just a brain fart on my end. In my UserRegistration model I was manipulating various fields from the form. When I passed those fields back to UserCreationForm for the save() method, I was not passing the password fields with it. Woops!

提交回复
热议问题