-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make natural key of userprofile unique #2249
base: main
Are you sure you want to change the base?
Conversation
a9e8f65
to
7debd0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code on its own is fine with me
7debd0f
to
b8f3424
Compare
next try: we use the pk as natural key for UserProfile. ModelBackend has to be disabled because it still passes the email (USERNAME_FIELD) to |
whyever the ci now breaks... |
5059628
to
d59095b
Compare
okay.. Current solution: Add an unique, non-editable UUIDField, and make it the natural key |
8f5310e
to
e7f37d0
Compare
I think this is worse than The additional database fields adds data clutter and migration clutter and is harder to reverse once django fixes their stuff. Edit: Following the discussion on the django forums, we probably just want to ditch |
dc706da
to
c72bcd3
Compare
c72bcd3
to
321c5c8
Compare
7c36072
to
47a9abb
Compare
# Stores the raw password if set_password() is called so that it can | ||
# be passed to password_changed() after the model is saved. | ||
_password = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? I don't think we care about password_changed
.
""" | ||
Always return False. This is a way of comparing User objects to | ||
anonymous users. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think our code uses this -- why do we need it?
(I wouldn't copy the docstring from the django class)
def set_unusable_password(self): | ||
# Set a value that will never be a valid hash | ||
self.password = make_password(None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just make this the default value (factory) for the field? There's only one usage which would go away.
def get_username(self): | ||
"""Return the username for this User.""" | ||
return getattr(self, self.USERNAME_FIELD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why needed?
close #2247
size oftest_data.json
increases a bit because every relation to userprofile now takes two lines...size of
test_data.json
decreases a bit because every relation to userprofile now takes two less lines...