Code

Opened 8 years ago

Closed 8 years ago

Last modified 7 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
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by Stefano J. Attardi

  • Resolution set to duplicate
  • Status changed from new to closed

See #1839.

comment:2 Changed 7 years ago by ubernostrum

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.