Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
7 tasks done
lorenzomorandini opened this issue May 27, 2021 · 1 comment
Open
7 tasks done

Comments

@lorenzomorandini
Copy link

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]

  • This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure and will not receive any support whatsoever.
  • I have verified that that issue exists against the master branch of django-smart-selects.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have debugged the issue to the smart_selects app.
  • I have reduced the issue to the simplest possible case.
  • I have included all relevant sections of models.py, forms.py, and views.py with problems.
  • I have used GitHub Flavored Markdown to style all of my posted code.

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants