-
Notifications
You must be signed in to change notification settings - Fork 42
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
Remove deprecated warning with django 3 #73
base: master
Are you sure you want to change the base?
Conversation
Thank you for the contribution @kutera |
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.
Thanks for the PR.
I think we will need to remove the custom validator validate_true_or_none.
Do we also need a data migration to update all the existing values of null/None to False?
_('is canonical?'), | ||
default=None, editable=False, | ||
default=False, editable=False, |
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.
@kutera, I suggest removing default=False
since the default value of BooleanField is None when default=
isn’t defined. Then you don't need the change in get_queryset
.
@@ -142,7 +142,7 @@ class NotCanonicalAliasManager(models.Manager): | |||
|
|||
def get_queryset(self): | |||
qset = super(NotCanonicalAliasManager, self).get_queryset() | |||
return qset.filter(is_canonical__isnull=True) | |||
return qset.filter(is_canonical=False) |
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.
@kutera if we don't set a default on the field class then we don't need this change
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.
This change avoid deprecated warning and error in future django release.
In django 3.1 See https://docs.djangoproject.com/en/dev/releases/3.1/#deprecated-features-3-1
"The undocumented usage of the isnull lookup with non-boolean values as the right-hand side will no longer be allowed."
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.
@kutera, I had missed that, thanks for pointing this out.
Hello,
On Django 3 a warning appears. Here a small commit with correction to avoid it.
I noticed a regression with tldextract==3.0.2 :
middelware.py 245: tldextract.TLDExtract(cache_file=self.psl_cache)
The cache_file option is replaced by cache_dir.
My work around was to add tldextract==2.2.3 in the requirements.
Best Regards