Opened 19 years ago
Closed 18 years ago
#1383 closed defect (worksforme)
ManyToManyField to a class with a OneToOneField fails
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | 0.91 |
Severity: | normal | Keywords: | OneToOneField |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This refers to django 0.91.
Under the following circumstances, the admin pages for class C fail on update:
class A(meta.Model):
name = meta.StringField(maxlength=60)
class B(meta.Model):
a = meta.OneToOneField(A)
class C(meta.Model):
b = meta.MultiToMultiField(B)
Inserting works, but as soon as you update, there's a bug in the following line:
file core/meta/init.py, lines 1139-1140
def method_set_many_to_many(rel_field, self, id_list):
current_ids = [obj.id for obj in method_get_many_to_many(rel_field, self)]
Since B is a "child" in a OneToOneField, it does not get an "id" attribute (instead, the primary key is in the object attribute b_id).
Change History (1)
comment:1 by , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Summary: | MultiToMultiField to a class with a OneToOneField fails → ManyToManyField to a class with a OneToOneField fails |
I used the models below, and I could not reproduce this problem. Please post back here if you still experience the error.