update admin and fix invoice image model
This commit is contained in:
parent
b7088f9844
commit
778e10bdeb
2 changed files with 36 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from core.models import FlavorPrice, VolumePrice, FloatingIpsPrice, BillingProject, Invoice, InvoiceVolume, \
|
||||
InvoiceFloatingIp, InvoiceInstance, DynamicSetting
|
||||
InvoiceFloatingIp, InvoiceInstance, DynamicSetting, InvoiceImage, ImagePrice, SnapshotPrice, RouterPrice, \
|
||||
InvoiceSnapshot, InvoiceRouter
|
||||
|
||||
|
||||
@admin.register(DynamicSetting)
|
||||
|
@ -24,6 +25,20 @@ class VolumePriceAdmin(admin.ModelAdmin):
|
|||
list_display = ('volume_type_id', 'hourly_price', 'monthly_price')
|
||||
|
||||
|
||||
@admin.register(RouterPrice)
|
||||
class RouterPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('hourly_price', 'monthly_price')
|
||||
|
||||
|
||||
@admin.register(SnapshotPrice)
|
||||
class SnapshotPriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('hourly_price', 'monthly_price')
|
||||
|
||||
@admin.register(ImagePrice)
|
||||
class ImagePriceAdmin(admin.ModelAdmin):
|
||||
list_display = ('hourly_price', 'monthly_price')
|
||||
|
||||
|
||||
@admin.register(BillingProject)
|
||||
class BillingProjectAdmin(admin.ModelAdmin):
|
||||
list_display = ('tenant_id',)
|
||||
|
@ -47,3 +62,18 @@ class InvoiceFloatingIpAdmin(admin.ModelAdmin):
|
|||
@admin.register(InvoiceVolume)
|
||||
class InvoiceVolumeAdmin(admin.ModelAdmin):
|
||||
list_display = ('volume_id',)
|
||||
|
||||
|
||||
@admin.register(InvoiceRouter)
|
||||
class InvoiceRouterAdmin(admin.ModelAdmin):
|
||||
list_display = ('router_id', 'name')
|
||||
|
||||
|
||||
@admin.register(InvoiceSnapshot)
|
||||
class InvoiceSnapshotAdmin(admin.ModelAdmin):
|
||||
list_display = ('snapshot_id', 'name', 'space_allocation_gb')
|
||||
|
||||
@admin.register(InvoiceImage)
|
||||
class InvoiceImageAdmin(admin.ModelAdmin):
|
||||
list_display = ('image_id', 'name', 'space_allocation_gb')
|
||||
|
||||
|
|
|
@ -173,9 +173,9 @@ class InvoiceImage(BaseModel, InvoiceComponentMixin):
|
|||
|
||||
# Informative
|
||||
name = models.CharField(max_length=256)
|
||||
#
|
||||
# @property
|
||||
# def price_charged(self):
|
||||
# price_without_allocation = super().price_charged
|
||||
# return price_without_allocation * math.ceil(self.space_allocation_gb)
|
||||
|
||||
@property
|
||||
def price_charged(self):
|
||||
price_without_allocation = super().price_charged
|
||||
return price_without_allocation * math.ceil(self.space_allocation_gb)
|
||||
# end region
|
||||
|
|
Loading…
Add table
Reference in a new issue