-1
t_cat_id = t_cat.id
cursor.execute("select offered_item,offered_item_category_id from foundation_swaptable where accepted_item = %s", t_cat.id)
上面的代码抛出下面的异常:django的 - “INT”对象没有属性“键”
“INT”对象没有属性“关键字”
当我包围t_cat.id与方括号如下:
cursor.execute("select offered_item,offered_item_category_id from foundation_swaptable where accepted_item = %s", [t_cat.id])
错误消失。
其中t_cat是MPTT类对象,其余如下取:
MpttCategory.objects.get(category_name=t_category)
并且它具有在DB表示的ID列是整数。
谁能告诉我为什么我得到这个例外。我无法将错误的含义与错误联系起来。 请告诉我是否需要更多信息..
ps。我有点醉了:)