admin中看不到数据库中已有数据,但能保存新数据到数据库。
我用Django连接neo4j图数据库,models.py如下
from neomodel import StructuredNode, StringProperty, DateProperty
from django_neomodel import DjangoNode
class Department(DjangoNode):
_id = StringProperty()
name = StringProperty()
trans = StringProperty()
class Meta:
app_label = "tbmb"
verbose_name = "科室"
verbose_name_plural = verbose_name
admin.py定义如下
from django.contrib import admin as dj_admin
from django_neomodel import admin as neo_admin
from .models import Department
class DepartmentAdmin(dj_admin.ModelAdmin):
list_display = ("_id",“name”,“trans”)
class Meta:
app_label = 'tbmb’
neo_admin.register(Department,DepartmentAdmin)
运行结果如图
admin中有models中定义的模型
点击增加也能添加数据至neo4j数据库
点击模型名称“科室”或者修改按钮,则不加载数据库中已有数据,提示错误