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

ChainedForeignKey empty_label can not be changed #319

Open
wongfl opened this issue Nov 18, 2020 · 1 comment
Open

ChainedForeignKey empty_label can not be changed #319

wongfl opened this issue Nov 18, 2020 · 1 comment

Comments

@wongfl
Copy link

wongfl commented Nov 18, 2020

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.
[x] I have verified that that issue exists against the master branch of django-smart-selects.
[x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
[x] I have debugged the issue to the smart_selects app.
[x] I have reduced the issue to the simplest possible case.
[x] I have included all relevant sections of models.py, forms.py, and views.py with problems.
[x]I have used GitHub Flavored Markdown to style all of my posted code.

I have the same issue. the first empty label has been changed to ' Select Cateogory' from the django default '------' .

But on the second select field (i.e the ChainedForeignKey in the model) , the empty_label is still showing the django default '----'

Please assists !!!

self.fields['category'].empty_label = 'SELECT CATEGORY' <--- works
self.fields['subcategory'].empty_label = 'SELECT CATEGORY' <--- Does not work

any solutions to this?

Originally posted by @Xhaxhi in #236 (comment)

@wongfl wongfl changed the title self.fields['category'].empty_label = 'SELECT CATEGORY' <--- works ChainedForeignKey empty_label can not be changed Nov 18, 2020
@NorDULaN
Copy link

NorDULaN commented Nov 23, 2020

Check the foreign key models.py for the absence of "to-field = yourchoose,".
Smart-selects only works with a pointer:
/ chaining / filter / app / model / field / field_id / fieldwhereyoucreate / field / yourvalue /
yourvalue = id of the parent subcategory.
It took me 3 hours to figure it out.
It would be nice to add all (part) your models.py code here.

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