from django.contrib import admin from django.db.models import JSONField from . import models from ..widgets import PrettyJSONWidget @admin.decorators.register(models.Text) class TextAdmin(admin.ModelAdmin): formfield_overrides = { JSONField: {'widget': PrettyJSONWidget} } list_display = ( '__str__', 'item', 'edit', 'language', 'slug', 'public', 'position', ) list_editable = ['public', 'language', 'position'] list_filter = ['language', 'public'] search_fields = ['slug', 'title', 'byline'] def item(self, obj): return obj.data.get('item') def edit(self, obj): return obj.data.get('edit') #@admin.decorators.register(models.Page) #class PageAdmin(admin.ModelAdmin): # pass