-
Notifications
You must be signed in to change notification settings - Fork 15
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
Allow null values for contact id on resource downloads #1180
Conversation
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.
Worth considering
Co-authored-by: django-doctor[bot] <72320148+django-doctor[bot]@users.noreply.github.com>
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.
Looks good. Worth considering though
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.
Worth considering
@@ -331,7 +331,7 @@ class ResourceDownload(models.Model): | |||
last_access = models.DateTimeField() | |||
number_of_times_accessed = models.IntegerField() | |||
resource_name = models.CharField(max_length=255, null=True, blank=False) | |||
contact_id = models.CharField(max_length=100, blank=True, default='') | |||
contact_id = models.CharField(max_length=100, null=True, blank=True) |
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.
contact_id = models.CharField(max_length=100, null=True, blank=True) | |
contact_id = models.CharField(max_length=100, default='', blank=True) |
null=True
on a string field causes inconsistent data types because the value can be either str
or None
. This adds complexity and maybe bugs, but can be solved by replacing null=True
with default=""
.
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.
So there's a case for null=True, after all.
I would have thought the |
No description provided.