Opened 13 years ago

Closed 13 years ago

#1577 closed defect (duplicate)

Edit inline broken for models with multiple foreign keys to another model.

Reported by: k.kosciuszkiewicz at gmail dot com Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: mir@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Test case:

class Publication(meta.Model):
    author = meta.CharField(maxlength=100)
    title = meta.CharField(maxlength=100)
    class META:
        admin = meta.Admin()

class Reference(meta.Model):
    position = meta.PositiveSmallIntegerField(core=True)
    cited    = meta.ForeignKey(Publication,
    citing   = meta.ForeignKey(Publication,
    class META:
        admin = meta.Admin()
        ordering = ['position']

This should be perfectly valid but breaks in django/contrib/admin/templatetags/ in method EditInlineMode.render() with statement:

    klass = relation.field.rel.edit_inline

that returns False instead of class name. This is propagated further to result in attempt to call False(...) instead of ClassName(...) later in template rendering code.

Change History (2)

comment:1 Changed 13 years ago by mir@…

Cc: mir@… added

comment:2 Changed 13 years ago by Gary Wilson <gary.wilson@…>

Resolution: duplicate
Status: newclosed

Marking this a duplicate of #1939, as there is more discussion there and also some code.

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