Opened 19 years ago

Closed 18 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

Description

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,
                    related_name="citation",
                    core=True)
    citing   = meta.ForeignKey(Publication,
                    related_name="reference",
                    edit_inline=meta.TABULAR)
    class META:
        admin = meta.Admin()
        ordering = ['position']

This should be perfectly valid but breaks in django/contrib/admin/templatetags/admin_modify.py 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 by mir@…, 19 years ago

Cc: mir@… added

comment:2 by Gary Wilson <gary.wilson@…>, 18 years ago

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