Added human readable representations of hosting order models to better manage order from the admin interface.

Related ticket:
https://redmine.ungleich.ch/issues/1715
This commit is contained in:
Efstratios Goudelis 2016-05-11 13:02:35 +03:00
commit 849c5a2270
6 changed files with 34 additions and 4 deletions

View file

@ -1,6 +1,8 @@
from django.contrib import admin
from .models import RailsBetaUser, VirtualMachineType
from .models import RailsBetaUser, VirtualMachineType, HostingOrder, VirtualMachinePlan
admin.site.register(RailsBetaUser)
admin.site.register(VirtualMachineType)
admin.site.register(HostingOrder)
admin.site.register(VirtualMachinePlan)

View file

@ -100,6 +100,12 @@ class VirtualMachinePlan(models.Model):
instance = cls.objects.create(**data)
return instance
def __str__(self):
"""
str cast with a friendly representation of the ContactMessage object
"""
return "Cores: %s, mem: %s, type: %s" % (self.cores, self.memory, self.vm_type)
class HostingOrder(models.Model):
@ -135,6 +141,11 @@ class HostingOrder(models.Model):
self.cc_brand = stripe_charge.source.brand
self.save()
def __str__(self):
"""
str cast with a friendly representation of the ContactMessage object
"""
return "Plan: %s, customer: %s, approved: %s" % (self.VMPlan, self.customer, self.approved)