【发布时间】:2011-11-07 10:18:32
【问题描述】:
升级到更新的 Django 版本后,我开始收到此弃用警告:
Django version 1.3, using settings 'demos.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/Users/.....myfile.py:328: DeprecationWarning: inner has been called without providing a connection argument.
if 'integer' in x.db_type()
我意识到这是由 Field.db_type 方法引起的,该方法返回字段的数据库列数据类型。该方法已被修改,以符合 Django 最新版本的多数据库特性,因此现在它还需要一个连接对象作为参数 [check the django docs]
但是如何传递那个连接对象呢?没看懂。。
【问题讨论】:
标签: django deprecated dbtype