apps: Truncate the api key to 15 characters + ...

This commit is contained in:
c0de 2017-06-01 21:33:55 -05:00
parent 7fcd9d6d2d
commit 06ddc6a305
1 changed files with 3 additions and 1 deletions

View File

@ -31,7 +31,9 @@ class api_apps(models.Model):
settings = JSONField(blank=True)
def __str__(self):
return '%s (%s) - %s' % (self.name, self.owner.name, self.apikey)
# Truncate the api key to the first 15 characters for identification
thekey = self.apikey[:15] + (self.apikey[:15] and '...')
return '%s (%s) - %s' % (self.name, self.owner.user.username, thekey)
@python_2_unicode_compatible