jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.1k stars 348 forks source link

Not working if primary key value of related object is 0 (zero) #331

Open lorenzomorandini opened 3 years ago

lorenzomorandini commented 3 years ago

You MUST use this template when reporting issues. Please make sure you follow the checklist and fill in all of the information sections below.


All versions of django-smart-selects prior to version 1.2.8 are vulnerable to an XSS attack as detailed in issue 171. As a result, all previous versions have been removed from PyPI to prevent users from installing insecure versions. All users are urged to upgrade as soon as possible.

Checklist

Put an x in the bracket when you have completed each task, like this: [x]

Steps to reproduce

  1. Create a model A with an integer primary key and create an instance of it with pk = 0 (zero)
  2. Create a model B with a chained foreign key to model A
  3. In admin create an instance of model B, selecting the instance with pk = 0 of model A

Actual behavior

Model B saves successfully but on opening it again the select appear empty.

Expected behavior

Select should show the saved instance of model A.

Possibly related to issue #326 (not sure tho).

faivala-de commented 1 year ago

Has anybody found a solution for this? My forms are working properly for all entries were the primary key value of related object is > 0, but 0 nothing shows... Thanks