Search code examples
djangodjango-formsdjango-users

Django show options


I have a database filled with values for first_name. I also made a form, which calls for an input of first_name. How can i give the user suggestions as they type of names that are already in the database?

Also, if i have someone entering 2 in one integerfield, and a 3 in another integerfield, how can i autocompute the product and show it in real-time?


Solution

  • The package https://github.com/yourlabs/django-autocomplete-light seems to be what you're looking for. It allows the end user to type some characters, after which it will be autocompleted/suggested from what's already in the DB.

    For autocomputing the two intergerfields, I'd go for client-side (Javascript).