class MenuList(admin.ModelAdmin):
list_display = ('menuId', 'menuName', 'menuDesc', 'menuType', 'sort_order') def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'status': #外键字段
kwargs["queryset"] = DictItem.objects.filter(groupId='menustatus')
return super(MenuList, self).formfield_for_foreignkey(db_field, request, **kwargs)