Register UserHostingKey to admin site and add str repr

This commit is contained in:
PCoder 2021-01-21 20:46:12 +05:30
parent af09b343c0
commit ac139c8a99
2 changed files with 12 additions and 0 deletions

View file

@ -3,6 +3,7 @@ from cms.admin.placeholderadmin import PlaceholderAdminMixin
from cms.extensions import PageExtensionAdmin from cms.extensions import PageExtensionAdmin
from .cms_models import CMSIntegration, CMSFaviconExtension from .cms_models import CMSIntegration, CMSFaviconExtension
from .models import VMPricing, VMTemplate from .models import VMPricing, VMTemplate
from hosting.models import UserHostingKey
class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin): class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
@ -17,3 +18,4 @@ admin.site.register(CMSIntegration, CMSIntegrationAdmin)
admin.site.register(CMSFaviconExtension, CMSFaviconExtensionAdmin) admin.site.register(CMSFaviconExtension, CMSFaviconExtensionAdmin)
admin.site.register(VMPricing) admin.site.register(VMPricing)
admin.site.register(VMTemplate) admin.site.register(VMTemplate)
admin.site.register(UserHostingKey)

View file

@ -208,6 +208,16 @@ class UserHostingKey(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
def __str__(self):
display_str = '%s - %s - %s - %s - %s' % (
self.user.username,
self.user.email,
self.name,
self.created_at,
self.public_key
)
return display_str
@staticmethod @staticmethod
def generate_RSA(bits=2048): def generate_RSA(bits=2048):
''' '''