I've already read a lot of questions related to this problem, like How to custom sort a Django queryset but no answer worked.
Here's are my models:
class Groupe(models.Model):
    parents = models.ManyToManyField('self', blank=True,
                                     through='GroupeRelation',
                                     symmetrical=False,
                                     related_name='parent')
    description = models.CharField(max_length=50)
class GroupeRelation(models.Model):
    groupe_parent = models.ForeignKey(Groupe,
                                      related_name='groupe_parent',
                                      verbose_name=_(u'Parent'))
    groupe_enfant = models.ForeignKey(Groupe,
                                      related_name='groupe_enfant',
                                      verbose_name=_(u'Enfant'))
class Mot(models.Model):
    groupes = models.ManyToManyField(Groupe)
    texte = models.CharField(max_length=50)
    def mot_avec_groupe(self):
        return str(self)
    mot_avec_groupe.short_description = _(u'Description')
    mot_avec_groupe.allow_tags = True
    def __str__(self):
        return _(u'{0} / {1}').format(
            u''.join([g.description for g in self.groupes.all()]),
            self.texte
        )
And I'm trying to display a sortable column in the admin of Mot like this:
class MotGroupesInline(admin.TabularInline):
    model = Mot.groupes.through
    extra = 0
class MotAdmin(admin.ModelAdmin):
    readonly_fields = ('mot_avec_groupe', )
    fields = ('texte', )
    inlines = (MotGroupesInline,)
    list_display = ('mot_avec_groupe', 'texte')
It's properly displayed, but I can't sort by mot_avec_groupe column. What am I missing?
 
     
    