introduce plan ordering and marking as best
This commit is contained in:
parent
9e0ccb6025
commit
c93f8de717
4 changed files with 132 additions and 21 deletions
|
@ -43,11 +43,14 @@ class PlanPriceInline(admin.TabularInline):
|
|||
|
||||
|
||||
class PlanInline(admin.StackedInline):
|
||||
"""Inline admin for Plan model"""
|
||||
"""Inline admin for Plan model with sortable ordering"""
|
||||
|
||||
model = Plan
|
||||
extra = 1
|
||||
fieldsets = ((None, {"fields": ("name", "description", "plan_description")}),)
|
||||
fieldsets = (
|
||||
(None, {"fields": ("name", "description", "plan_description")}),
|
||||
("Display Options", {"fields": ("is_best",)}),
|
||||
)
|
||||
show_change_link = True # This allows clicking through to the Plan admin where prices can be managed
|
||||
|
||||
|
||||
|
@ -138,12 +141,17 @@ class ServiceOfferingAdmin(admin.ModelAdmin):
|
|||
|
||||
@admin.register(Plan)
|
||||
class PlanAdmin(admin.ModelAdmin):
|
||||
"""Admin configuration for Plan model"""
|
||||
"""Admin configuration for Plan model with sortable ordering"""
|
||||
|
||||
list_display = ("name", "offering", "price_summary")
|
||||
list_filter = ("offering__service", "offering__cloud_provider")
|
||||
list_display = ("name", "offering", "is_best", "price_summary", "order")
|
||||
list_filter = ("offering__service", "offering__cloud_provider", "is_best")
|
||||
search_fields = ("name", "description", "offering__service__name")
|
||||
list_editable = ("is_best",)
|
||||
inlines = [PlanPriceInline]
|
||||
fieldsets = (
|
||||
(None, {"fields": ("name", "offering", "description", "plan_description")}),
|
||||
("Display Options", {"fields": ("is_best", "order")}),
|
||||
)
|
||||
|
||||
def price_summary(self, obj):
|
||||
"""Display a summary of prices for this plan"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue