diff --git a/datacenterlight/admin.py b/datacenterlight/admin.py index 5a1fc8a2..334a6c06 100644 --- a/datacenterlight/admin.py +++ b/datacenterlight/admin.py @@ -3,6 +3,7 @@ from cms.admin.placeholderadmin import PlaceholderAdminMixin from cms.extensions import PageExtensionAdmin from .cms_models import CMSIntegration, CMSFaviconExtension from .models import VMPricing, VMTemplate +from hosting.models import UserHostingKey class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin): @@ -17,3 +18,4 @@ admin.site.register(CMSIntegration, CMSIntegrationAdmin) admin.site.register(CMSFaviconExtension, CMSFaviconExtensionAdmin) admin.site.register(VMPricing) admin.site.register(VMTemplate) +admin.site.register(UserHostingKey) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 03013ea5..a88938ce 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -79,9 +79,9 @@ SECRET_KEY = env('DJANGO_SECRET_KEY') INSTALLED_APPS = ( # 1st migrate + 'hosting', 'membership', 'djangocms_admin_style', - 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.humanize', @@ -144,7 +144,6 @@ INSTALLED_APPS = ( # ungleich 'ungleich', 'ungleich_page', - 'hosting', 'digitalglarus', 'nosystemd', 'datacenterlight', @@ -154,6 +153,7 @@ INSTALLED_APPS = ( 'opennebula_api', 'django_celery_results', 'webhook', + 'django.contrib.admin', ) MIDDLEWARE_CLASSES = ( @@ -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': { diff --git a/hosting/models.py b/hosting/models.py index 48238afe..16297ab8 100644 --- a/hosting/models.py +++ b/hosting/models.py @@ -208,6 +208,25 @@ class UserHostingKey(models.Model): created_at = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=100) + def __str__(self): + 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 + ) + return display_str + @staticmethod def generate_RSA(bits=2048): ''' diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html new file mode 100644 index 00000000..00e31c8f --- /dev/null +++ b/templates/admin/base_site.html @@ -0,0 +1,18 @@ +{% extends "admin/base_site.html" %} +{% block extrahead %} + +{% endblock %} \ No newline at end of file