drag drop ordering for faqs
This commit is contained in:
parent
b45c725c1a
commit
d87929f6b4
4 changed files with 24 additions and 6 deletions
|
@ -1,5 +1,9 @@
|
|||
from nested_admin import NestedStackedInline, NestedModelAdmin
|
||||
|
||||
from django.contrib import admin
|
||||
from django.utils.html import format_html
|
||||
from adminsortable2.admin import SortableAdminMixin
|
||||
|
||||
from .models import (
|
||||
Category,
|
||||
CloudProvider,
|
||||
|
@ -14,10 +18,8 @@ from .models import (
|
|||
WebsiteFaq,
|
||||
)
|
||||
|
||||
import nested_admin
|
||||
|
||||
|
||||
class PlanInline(nested_admin.NestedStackedInline):
|
||||
class PlanInline(NestedStackedInline):
|
||||
model = Plan
|
||||
extra = 1
|
||||
fieldsets = (
|
||||
|
@ -32,7 +34,7 @@ class ExternalLinkOfferingInline(admin.TabularInline):
|
|||
ordering = ("order", "description")
|
||||
|
||||
|
||||
class OfferingInline(nested_admin.NestedStackedInline):
|
||||
class OfferingInline(NestedStackedInline):
|
||||
model = ServiceOffering
|
||||
extra = 1
|
||||
fieldsets = (
|
||||
|
@ -68,7 +70,7 @@ class CategoryAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
@admin.register(CloudProvider)
|
||||
class CloudProviderAdmin(nested_admin.NestedModelAdmin):
|
||||
class CloudProviderAdmin(NestedModelAdmin):
|
||||
list_display = ("name", "slug", "logo_preview")
|
||||
search_fields = ("name", "description")
|
||||
prepopulated_fields = {"slug": ("name",)}
|
||||
|
@ -152,7 +154,7 @@ class LeadAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
@admin.register(WebsiteFaq)
|
||||
class WebsiteFaqAdmin(admin.ModelAdmin):
|
||||
class WebsiteFaqAdmin(SortableAdminMixin, admin.ModelAdmin):
|
||||
list_display = ("question", "order")
|
||||
search_fields = ("question", "answer")
|
||||
ordering = ("order",)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue