我的项目在 Django-1.2.5 和 Django-1.3.1 上运行良好,但在 Django-1.4.1 上运行良好。
我无法保存/创建对象并收到如下错误:
from entry.models import Entry
import datetime
from publications.models import Publication
e = Entry(title=u'this is a test headline to test django-1.4.1',
body_html=u'this is a test body data to test django-1.4.1',
pub_date=datetime.datetime.now(),
publication=Publication.objects.get(id=1))
e.save()
错误:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/admin/banking_code/contify-banking/entry/models.py", line 112, in save
super(Entry, self).save()
File "/home/admin/banking_code/contify-banking/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/admin/banking_code/contify-banking/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/home/admin/banking_code/contify-banking/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/home/admin/banking_code/contify-banking/django/db/models/query.py", line 1593, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/admin/banking_code/contify-banking/django/db/models/sql/compiler.py", line 914, in execute_sql
return self.connection.ops.fetch_returned_insert_id(cursor)
File "/home/admin/banking_code/contify-banking/django/db/backends/__init__.py", line 548, in fetch_returned_insert_id
return cursor.fetchone()[0]
TypeError: 'NoneType' object is not subscriptable
任何人都可以帮我解决这个问题吗?