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,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b6d6b352-8003-461c-9063-df63d7094d2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to