我正在使用Django框架进行编码,我被困在这个问题上:
usercomment = 'Test'
usercomments = json.dumps(usercomment)
data = {
'date': '2019-02-06',
'usercomments': usercomments,
'totalminutes': '120',
'searched': 'functionTest'
}
在这一行,我在数据库中创建条目。你知道吗
response = self.client.post("/urlRegistration/", data=data, follow=True)
但是,当我想获得在数据库中创建的对象的唯一id时,我不能,因为连接已关闭
myObject = Myobject.objects.filter(usercomment=usercomment)
uniqueid = myObject[0].uniqueid
你能帮帮我吗?你知道吗
非常感谢!你知道吗
编辑:Python告诉我:
cursor = self.connection.cursor()
psycopg2.InterfaceError: connection already closed
对于我得到的变量响应:<HttpResponse status_code=200, "application/json">
目前没有回答
相关问题 更多 >
编程相关推荐