Opened 7 years ago

Closed 7 years ago

#11682 closed (fixed)

[soc2009/admin-ui] index can be 0 causing saving model with inlines to fail

Reported by: fredbartle Owned by: nobody
Component: contrib.admin Version: soc2009/admin-ui
Severity: Keywords: admin-ui
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In forms/ r11400

678 	                try:
679 	                    if index:
680 	                        pk_value = self.get_queryset()[index].pk
681 	                    else:
682 	                        pk_value = None
683 	                except IndexError:
684 	                    pk_value = None

'index' can be zero and therefore evaluate to False, pk_value is set to None, and the hidden AutoField is rendered without a pk value, causing a save to fail.

I did not see soc2009/admin-ui in version dropdown, so I left version empty.

Attachments (1)

admin-ui-11682.diff (597 bytes) - added by fredbartle 7 years ago.
Check if index is not None

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by fredbartle

Check if index is not None

comment:1 Changed 7 years ago by fredbartle

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Not sure if this is the place to be filing tickets for SoC projects.

comment:2 Changed 7 years ago by fredbartle

  • Keywords admin-ui added
  • Version set to soc2009/admin-ui

comment:3 Changed 7 years ago by zain

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

Thanks. Fixed in r11935.

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