How to override the str method when rendering StackedInline field?
<p>I have a many to many relationship:</p>
<pre><code>class GroupeCategoriesCategorie(models.Model):
    groupe_categories = models.ForeignKey(GroupeCategories,
                                          related_name='groupe',
                                          verbose_name=_(u'Groupe'))
    categorie = models.ForeignKey(Categorie,
                                  related_name='categorie',
                                  verbose_name=_(u'Catégorie'))

    def __str__(self):
        return _(u'{} / {}').format(self.groupe_categories, self.categorie)
</code></pre>
<p>I always need a representation like the <code>__str__</code> method before <strong>except</strong> when rendering in the admin. Why? My <code>admin.py</code> looks like that:</p>
<pre><code>class GroupeCategoriesCategoriesInline(CollapsedStackedInline):
    model = GroupeCategories.liens.through
    fk_name = 'groupe_categories'
    raw_id_fields = ('categorie',)
    extra = 0    

class GroupeCategoriesAdmin(admin.ModelAdmin):

    fields = ('description', 'exemple',)
    inlines = (GroupeCategoriesCategoriesInline,)
</code></pre>
<p>And here's the result:</p>
<p><a href="https://i.stack.imgur.com/7TK9r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7TK9r.jpg" alt="django manytomany" /></a></p>
<p>As you can see, when you edit a <code>GroupeCategories</code>, you see the <code>Description</code> field first, and this <code>description</code> is repeated for each manytomany row just after... this is ugly. I'd like to override the <code>__str__</code> method, but <strong>only here</strong>. How do you do that?</p>