Django

Code

Ticket #1826 (closed: duplicate)

Opened 2 years ago

Last modified 1 year ago

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

Reported by: Stefano J. Attardi <django@attardi.org> Assigned to: adrian
Milestone: Component: Admin interface
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

05/13/06 12:48:56 changed by Stefano J. Attardi

  • status changed from new to closed.
  • resolution set to duplicate.

See #1839.

03/07/07 11:03:44 changed 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/Change #1826 (Model crashes with ForeignKey('self') and a field with the same name)




Change Properties
Action