srmagura/goodnight-lead

manage.py createsuperuser does not create LeadUserInfo

srmagura opened this issue · 5 comments

To reproduce:

  1. Create a superuser from the command line using
    python3 manage.py createsuperuser
  2. Log in to the public site (i.e. not admin site) and go to the account settings page (via upper right corner).
  3. Error occurs because LeadUserInfo does not exist:
    RelatedObjectDoesNotExist at /account-settings

Easiest way to handle this would be to just deny the login attempt if the user does not have a LeadUserInfo.

There's nothing we can do about createsuperuser, since the django user model does not have the additional demographics object that we have implemented.

We can deny login based on lack of demographic information, but we will have to code around some users not having demographics when querying the database.

Working around some users not having LeadUserInfo won't be hard. You can
query using the LeadUserInfo class, for example.

2015-06-28 21:53 GMT-04:00 EricHorton notifications@github.com:

There's nothing we can do about createsuperuser, since the django user
model does not have the additional demographics object that we have
implemented.

We can deny login based on lack of demographic information, but we will
have to code around some users not having demographics when querying the
database.


Reply to this email directly or view it on GitHub
#20 (comment)
.

A better long term solution might be to look at using a PrimaryKey field on the model rather than a OneToOne field. That way there is no expectation that a user has demographics, but all demographics will have a user.

Returning the list of users with demographics after that should be whatever django's version of an inner join is.

Ok. Whichever way you decide to do it is fine.