Remove deprecated warning with django 3#73
Conversation
|
Thank you for the contribution @kutera |
chewthemonkey
left a comment
There was a problem hiding this comment.
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 = models.BooleanField( | ||
| _('is canonical?'), | ||
| default=None, editable=False, | ||
| default=False, editable=False, |
There was a problem hiding this comment.
@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.
| 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.
@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.
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.
@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