OutstandingToken user should be nullified with SET_NULL#267
Open
Andrew-Chen-Wang wants to merge 3 commits intojazzband:masterfrom
Open
OutstandingToken user should be nullified with SET_NULL#267Andrew-Chen-Wang wants to merge 3 commits intojazzband:masterfrom
Andrew-Chen-Wang wants to merge 3 commits intojazzband:masterfrom
Conversation
Member
Author
Member
Author
|
TODO Should use a new migration file or else upgraders will not get the changes. i.e. not ready |
| model_name='outstandingtoken', | ||
| name='user', | ||
| field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
| field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), |
Member
Author
There was a problem hiding this comment.
This should be in a separate file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #266 #232 #201
Originally, in the model of OutstandingToken, you can see that the user attribute is supposed to be null if the user is deleted. If it remained
on_delete=models.CASCADEthen there would be no point innull=Trueandblank=True. I think the implementation was just unintended behavior, so the cascading on user deletion should set the OutstandingToken's user to null.