Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#1826 closed defect (duplicate)

Model crashes with ForeignKey('self') and a field with the same name

Reported by: Stefano J. Attardi <django@…> Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following model will fail on install:

class Test(models.Model):
    this = models.ForeignKey("self")
    test = models.TextField()
    class Admin: pass

with this message:

At least one field in Test should have core=True, because it's being edited inline by test.Test.

If you add core=True as the message suggests:

class Test(models.Model):
    this = models.ForeignKey("self")
    test = models.TextField(core=True)
    class Admin: pass

then the admin crashes on the add page with the following error:

Exception Type:	AttributeError
Exception Value:	'bool' object has no attribute 'get'
Exception Location:	django\db\models\related.py in get_manipulator_fields, line 112

Change History (2)

comment:1 by Stefano J. Attardi, 18 years ago

Resolution: duplicate
Status: newclosed

See #1839.

comment:2 by James Bennett, 18 years ago

(In [4673]) 0.91-bugfixes: Fixed #999 by resolving name clash in the metasystem which could confuse manipulators about which fields they should follow. Refs #1808, #1826, #1839 and #2415, which are variations of this that persist in trunk.

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