From 96f4d09f0ab0fe0950fb1aa6363933057e6e7203 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Wed, 8 Feb 2017 18:04:18 +0100 Subject: [PATCH] [models] Improved Config.templates.through __str__ repr See https://github.com/gregmuellegger/django-sortedm2m/issues/96 --- django_netjsonconfig/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/django_netjsonconfig/models.py b/django_netjsonconfig/models.py index 20d75e0..f6b48f4 100644 --- a/django_netjsonconfig/models.py +++ b/django_netjsonconfig/models.py @@ -11,6 +11,16 @@ class Meta(AbstractConfig.Meta): abstract = False +def sortedm2m__str__(self): + """ + Improves string representation of m2m relationship objects + """ + return self.config.name + + +Config.templates.through.__str__ = sortedm2m__str__ + + class Template(AbstractTemplate): """ Concrete Template model