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

id = 0 #166

Open
mandrej opened this issue May 18, 2016 · 2 comments
Open

id = 0 #166

mandrej opened this issue May 18, 2016 · 2 comments

Comments

@mandrej
Copy link

mandrej commented May 18, 2016

I am using AutoCompleteSelectWidget and it's working fine. Problem is when I have id = 0 (legacy data base), widget doesn't populate this field and matching field is empty string. Autosugest is working. Please help

@mlavin
Copy link
Owner

mlavin commented May 18, 2016

If I had to venture a guess it's this conditional in the decompress which is seeing the 0 and not populating the value: https://github.com/mlavin/django-selectable/blob/master/selectable/forms/widgets.py#L70

@mandrej
Copy link
Author

mandrej commented May 25, 2016

Thank you for your help. I changed:

/selectable/forms/widgets.py

def decompress(self, value):
if value is not None:
...

and:

/selectable/base.py

class ModelLookup(LookupBase):
def get_item(self, value):
item = None
if value is not None:
...

On Wed, May 18, 2016 at 2:45 PM, Mark Lavin [email protected]
wrote:

If I had to venture a guess it's this conditional in the decompress which
is seeing the 0 and not populating the value:
https://github.com/mlavin/django-selectable/blob/master/selectable/forms/widgets.py#L70


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#166 (comment)

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