TA的每日心情 | 无聊 12 小时前 |
---|
签到天数: 531 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
python3.8.0 执行插入数据语句时,报错:NameError:name 'Event' is not defined 这是什么原因呢?- 语句:
- from django.contrib import admin
- from sign.models import Event, Guest
- # Register your models here.
- class EventAdmin(admin.ModelAdmin):
- list_display = ['name','status','start_time','id']
- search_fields = ['name'] # 搜索栏
- list_filter = ['status'] # 过滤器
- class GuestAdmin(admin.ModelAdmin):
- list_display = ['realname','phone','email','sign','create_time','event']
- search_fields = ['realname','phone'] # 搜索栏
- list_filter = ['sign'] # 过滤器
- admin.site.register(Event,EventAdmin)
- admin.site.register(Guest,GuestAdmin)
复制代码
|
|