我尝试使用admin.py
中的list_display引用键
Json的键名包含空格。
我收到此错误:
(admin.E108) The value of 'list_display[1]' refers to 'data__Service ID' , which is not a callable, an attribute of 'BotAdmin', or an attribute or method on 'myapp.Bot'
代码:
class Bot(models.Model):
data = JSONField(default=dict, encoder=DjangoJSONEncoder)
class BotAdmin(admin.ModelAdmin):
list_display = (
'data__Title',
'data__Service ID'
)