Opened 11 years ago

Closed 11 years ago

#6561 closed (invalid)

Duplicated row entries with edit_inline=models.Tabular

Reported by: toomim Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Fixed on a branch
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I'm editing a model A with two choice fields inline in a model B, using a 2x5 table.

class PubAuthor(models.Model):
    author = models.ForeignKey(Person, core=True)
    author_number = models.IntegerField(core=True, choices=[(1, 1), (2, 2), (3,3), (4,4), (5,5)])
    pub = models.ForeignKey('Pub', edit_inline=models.TABULAR, num_in_admin=5, num_extra_on_change=5)

This works, except that if I edit a Pub and set only the FIRST row's author and author_number, and there is only 1 author in the database, then if I reload the page, the admin interface fills every row of the "author" column with that author! The "Author number" column remains empty.

This then gives me a validation error if I try to save it.

This seems to only happen if there's a single author in the database.

Attachments (1)

Picture 9.png (11.9 KB) - added by toomim 11 years ago.
Screenshot showing every row erroneously filled after reloading a Pub

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by toomim

Attachment: Picture 9.png added

Screenshot showing every row erroneously filled after reloading a Pub

comment:1 Changed 11 years ago by Honza Král

Resolution: invalid
Status: newclosed
Triage Stage: UnreviewedFixed on a branch

Fixed on newforms-admin branch. Since that is nearing completion, no more patches will be applied against odlforms-admin.

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