Opened 7 years ago

Closed 7 years ago

#10894 closed (wontfix) does not throw exception when selected foreign key does not exists

Reported by: Carlos <ble.jurado@…> Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


client = Client(), {'param1': "just_a_text", 'multiselect_many2many': ('1',)})

But foreign key 1 does not exists.

Current behavior: status code 200 plus

Expected behavior: runtime exception

Change History (4)

comment:1 Changed 7 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Can you post a simple self-contained minimal example of what you are reporting?. currently the report is confusing and makes hard to start reviewing it. You mention a a foreign key but then the code snippet contains a multiselect_many2many bit.

comment:2 Changed 7 years ago by Carlos <ble.jurado@…>

Say the form has a ForeignKey. It gets rendered as a dropdown ('select' in html). Using you send a dictionary which key is the dropdown name but its value is a number which does not match any item in the foreign table.
Better now?


comment:3 Changed 7 years ago by kmtracey

You've still completely left out the view that processes the post data. Even without that, though, I'm not understanding why your expected behavior would be a runtime exception. I wouldn't want that. Using the standard form processing formula (validate form, if it's OK do whatever is being requested and redirect to a different page otherwise re-display the existing page), what you are listing as the current behavior is correct. Why do you expect a runtime exception?

comment:4 Changed 7 years ago by carlosble

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

Good point mktracey. I thought this use case could not be performed through the UI as the browser does not let you pick a foreign key which is not in the rendered dropdow, but if there are several users accesing the site and one deletes the foreign key selected by the other, then you get same case which solution would be a redirect as you point. I am getting status_code 200 but I guess it is up to me to validate and get a 30x code.
Thanks :-)

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