#10074 closed (worksforme)
Can't delete objects with lazy GenericRelations
Reported by: | Clay McClure | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | genericrelation delete | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Models with GenericRelation fields defined as:
the_relation = generic.GenericRelation('Related')
produce objects that cannot be deleted:
>>> obj.delete() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "lib/django/db/models/base.py", line 463, in delete delete_objects(seen_objs) File "lib/django/db/models/query.py", line 867, in delete_objects del_query.delete_batch_related(pk_list) File "lib/django/db/models/sql/subqueries.py", line 61, in delete_batch_related field = f.rel.to._meta.get_field(f.content_type_field_name) AttributeError: 'str' object has no attribute '_meta'
Attachments (1)
Change History (5)
comment:1 by , 16 years ago
Description: | modified (diff) |
---|
comment:2 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
I'm pretty sure the bug here is that generic relations aren't correctly accepting strings and need an actual class.
by , 16 years ago
Attachment: | lazy-generic-rel.diff added |
---|
I can't reproduce with the above, have I misunderstood the bug report?
comment:3 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Alex can't reproduce; neither can I.
Note:
See TracTickets
for help on using tickets.
(edited description)