Change the str repr

This commit is contained in:
PCoder 2021-01-22 22:41:56 +05:30
parent c6f05889ff
commit e51af13a31
3 changed files with 14 additions and 4 deletions

View File

@ -79,6 +79,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY')
INSTALLED_APPS = (
# 1st migrate
'hosting',
'membership',
'djangocms_admin_style',
'django.contrib.auth',
@ -143,7 +144,6 @@ INSTALLED_APPS = (
# ungleich
'ungleich',
'ungleich_page',
'hosting',
'digitalglarus',
'nosystemd',
'datacenterlight',
@ -196,6 +196,7 @@ TEMPLATES = [
os.path.join(PROJECT_DIR, 'cms_templates/'),
os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'),
os.path.join(PROJECT_DIR, 'templates/gdpr'),
os.path.join(PROJECT_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {

View File

@ -209,9 +209,18 @@ class UserHostingKey(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
display_str = '%s - %s - %s - %s - %s' % (
self.user.username,
self.user.email,
username = "None"
email = "None"
if self.user:
username = self.user.username
email = self.user.email
display_str = '''Username: %s,
Email: %s,
Key name: %s,
Created at: %s,
Public Key: %s''' % (
username,
email,
self.name,
self.created_at,
self.public_key