From 004181427ec5e7ec40534f09ee83a77287bb24c6 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 15 Jan 2018 15:49:12 -0600 Subject: [PATCH] Better stringification and meta info for auth tokens --- course/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/course/models.py b/course/models.py index 847e23e1..a1827c13 100644 --- a/course/models.py +++ b/course/models.py @@ -771,6 +771,20 @@ class AuthenticationToken(models.Model): null=True, blank=True, unique=True, verbose_name=_('Hash of git authentication token')) + def __unicode__(self): + return _("Token %(id)d for %(participation)s: %(description)s") % { + "id": self.id, + "participation": self.participation, + "description": self.description} + + if six.PY3: + __str__ = __unicode__ + + class Meta: + verbose_name = _("Authentication token") + verbose_name_plural = _("Authentication tokens") + ordering = ("participation", "creation_time") + # }}} -- GitLab