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

Documentation typo #16

Open
ramalhoruben opened this issue Jan 25, 2025 · 1 comment
Open

Documentation typo #16

ramalhoruben opened this issue Jan 25, 2025 · 1 comment

Comments

@ramalhoruben
Copy link

Hi,

Starting to explore your project.
Just tough to warn you that I think you might have a typo on the documentation at:
https://pypi.org/project/django-tomselect/

At:

class MyForm(forms.Form):
    person = TomSelectModelChoiceField(
        TomSelectConfig(
            url="person_autocomplete",
            value_field="id",
            label_field="full_name",
        )
    )

I think you mean:

class MyForm(forms.Form):
    person = TomSelectModelChoiceField(
        config = TomSelectConfig(
            url="person_autocomplete",
            value_field="id",
            label_field="full_name",
        )
    )

Otherwise it raises an error; seems to be correct at: https://django-tomselect.readthedocs.io/en/latest/usage.html

@ramalhoruben
Copy link
Author

Also.. in the starting examples of 'AutocompleteModelView' the attribute 'value_fields' is not mentioned, leading to field data not being provided by endpoints, and the TS listing pages but with undefined labels. Left me scratching my head for a while.

from django_tomselect.autocompletes import AutocompleteModelView

class PersonAutocompleteView(AutocompleteModelView):
    model = Person
    search_lookups = ["full_name__icontains"]
from django_tomselect.autocompletes import AutocompleteModelView

class PersonAutocompleteView(AutocompleteModelView):
    model = Person
    search_lookups = ["full_name__icontains"]
    value_fields = ["id","full_name"]

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

1 participant