-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change actstream models ids type from Char to UUID #1
base: master
Are you sure you want to change the base?
Conversation
actstream/models.py
Outdated
@@ -24,7 +26,7 @@ class Follow(models.Model): | |||
content_type = models.ForeignKey( | |||
ContentType, on_delete=models.CASCADE, db_index=True | |||
) | |||
object_id = models.CharField(max_length=255, db_index=True) | |||
object_id = models.UUIDField(max_length=255, db_index=True, default=uuid.uuid4) |
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.
@Vaibhav015 i think we do not need to add default=uuid.uuid4
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.
Also, why have we given max_length
in uuid field ? I mean do not require this ?
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.
As per docs, It's recommended to use default
in UUIDField @veerat-pdgt
Ref Docs: https://docs.djangoproject.com/en/3.0/ref/models/fields/#uuidfield
cc @vikalpj
Let me know your thoughts @veerat-pdgt @vikalpj 🙂
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.
@vaibhav-pdgt The case mentioned in doc is only applicable when we have PK for uuid. else default should always be based on the usecase. :)
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.
yeah, thanks @vikalpj
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.
fixes done
Changes LGTM @vaibhav-pdgt |
6e43309
to
ab362d9
Compare
Change actstream models ids type from Char to UUID
Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)