Opened 16 years ago

Last modified 13 years ago

#10205 closed

Update on a QuerySet with filter of field__in='' causes AttributeError — at Initial Version

Reported by: anonymous Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: rico.bl@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Let testfield be models.CharField

TestModel.objects.filter(testfield__in='')
>>> []
TestModel.objects.filter(testfield__in=())
>>> []
TestModel.objects.filter(testfield__in=()).delete()
>>>
TestModel.objects.filter(testfield__in='non-existent-entry').update(testfield='test')
>>> 0
TestModel.objects.filter(testfield__in='').update(testfield='test')
as well as
TestModel.objects.filter(testfield__in=()).update(testfield='test')
>>> causes following trackback:

'NoneType' object has no attribute 'rowcount'
File "C:\Python25\lib\site-packages\django\db\models\query.py" in update

  1. rows = query.execute_sql(None)

File "C:\Python25\lib\site-packages\django\db\models\sql\subqueries.py" in execute_sql

  1. rows = cursor.rowcount

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top