Opened 17 years ago
Last modified 14 years ago
#10205 closed
Update on a QuerySet with filter of field__in='' causes AttributeError — at Version 1
| 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 (last modified by )
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 448. rows = query.execute_sql(None) File "C:\Python25\lib\site-packages\django\db\models\sql\subqueries.py" in execute_sql 120. rows = cursor.rowcount
Change History (2)
comment:1 by , 17 years ago
| Description: | modified (diff) |
|---|
by , 17 years ago
| Attachment: | subqueries.py.diff added |
|---|
Patch to execute_sql in django/db/models/sql/subqueries.py
Note:
See TracTickets
for help on using tickets.
cleaned up formatting.