我已经尝试了很多,但无法弄清楚为什么会这样,
class FortressUserAdmin(admin.ModelAdmin):
list_display(. . . , get_my_schema)
def get_my_schema(self, obj):
sql_query = "select prop_val from customer_property where customer_id = %d and property_value like '%%%%SCHEMA%%%%'" % obj.customer_id.customer_id
property_value = connection.cursor().execute(sql_query).fetch_one()
print sql_query
return 1
# return "aditya"
get_my_schema.short_description = 'Schema Instance'
- 为什么列值总是
(None)
- 为什么
print 1
orprint 'aditya'
不会向控制台打印任何内容
专栏管理网站的屏幕截图: