Hello,
I am trying to migrate from Python 2, Django 1.8 to Python 3, Django 1.11 and I have a little problem with dictsort filter whith Null values.
The following code was working on Django 1.8, Python 2 :
Extract from models.py:
class Edition(models.Model):
titre = models.CharField(max_length=510, blank=True)
annee_publication = models.IntegerField(blank=True, null=True)
collectifs = models.ManyToManyField('Collectif', through='EditeOeuvre',
related_name='edition_collectifs',
verbose_name="Collectifs")
[...]
class EditeOeuvre(models.Model):
edition = models.ForeignKey('Edition')
collectif = models.ForeignKey('Collectif', blank=True, null=True,)
[...]
Extract from views.py:
def collectif(request, id):
collectif = get_object_or_404(Collectif.objects.prefetch_related('edition_collectifs'), pk=id)
[...]
return render(request, 'prelib/collectif.html', context)
With Django 1.8, I could sort collectif.edition_collectifs.all even if some annee_publication were Null :
{% for edition in collectif.edition_collectifs.all|dictsort:"annee_publication" %}
{{ edition }}
{% endfor %}
With Django 1.11, if some annee_publication are Null, no
{{ edition }} are displayed...
Is this a bug or did I something wrong ?
Thanks,