define inlines for easier record editing
This commit is contained in:
parent
d3d5409452
commit
eb5e4b0534
1 changed files with 8 additions and 1 deletions
|
@ -31,11 +31,18 @@ class CategoryAdmin(admin.ModelAdmin):
|
|||
ordering = ("order", "name")
|
||||
|
||||
|
||||
class OfferingInline(admin.StackedInline):
|
||||
model = ServiceOffering
|
||||
extra = 1
|
||||
fieldsets = ((None, {"fields": ("description", "service", "cloud_provider")}),)
|
||||
|
||||
|
||||
@admin.register(CloudProvider)
|
||||
class CloudProviderAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "slug", "logo_preview")
|
||||
search_fields = ("name", "description")
|
||||
prepopulated_fields = {"slug": ("name",)}
|
||||
inlines = [OfferingInline]
|
||||
|
||||
def logo_preview(self, obj):
|
||||
if obj.logo:
|
||||
|
@ -61,7 +68,7 @@ class ServiceAdmin(admin.ModelAdmin):
|
|||
search_fields = ("name", "description", "slug")
|
||||
prepopulated_fields = {"slug": ("name",)}
|
||||
filter_horizontal = ("categories",)
|
||||
inlines = [ExternalLinkInline]
|
||||
inlines = [ExternalLinkInline, OfferingInline]
|
||||
|
||||
def logo_preview(self, obj):
|
||||
if obj.logo:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue