Two Things: (1)-ModelChoiceField with a searchbox and (2)-Related Dropboxes

29 views
Skip to first unread message

Miguel Pereira Legal

unread,
Jul 13, 2015, 2:27:46 PM7/13/15
to django...@googlegroups.com
I have this two questions:

I am trying to write a small stock management system, and I am finding problems in the Form.
See, when an item goes out I have a dropbox (ChoiceField) to choose the item that is going out, but this dropbox gets too long when you have so many elements in the data base to choose from.

There is a way to implement a ChoiceField with a integrated search box to make this search and selection more flexible?

If anyone have another idea, I will listen.

In the other hand, about the related dropboxes.
What about if I have a Form where I need to chose a Manufacturer and THEN a Model (i.e Samsung and then S6).

I need that after the selection of "Samsung" the next dropbox filter the options for that manufacturer. I need that functionality because if the user can choose freely the Manufacturer and then de model, it could be wrong (i.e. the user could choose Samsung and then 6S, and 6S is not a cellphone model of Samsung).

Thanks for your patience.

felix

unread,
Jul 15, 2015, 9:26:07 PM7/15/15
to django...@googlegroups.com
El 13/07/15 10:09, Miguel Pereira Legal escribió:
I'm a newbie and I guess that you need to use AJAX to accomplish these tasks.
A javascript library, or framework like AngularJS could be useful here.

Cheers,
Felix.

Dan Tagg

unread,
Jul 15, 2015, 11:28:52 PM7/15/15
to django...@googlegroups.com

Select2 can do this https://select2.github.io. Other alternatives are available too.

Dan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/742c2210-5cce-42cb-9997-c9258fd602db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

François Schiettecatte

unread,
Jul 16, 2015, 12:50:12 AM7/16/15
to django...@googlegroups.com
Another option would be JQuery Autocomplete:

https://github.com/devbridge/jQuery-Autocomplete

I have used both, JQuery Autocomplete is simpler to get going but Select2 is more flexible.

François
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPZHCY4FFYe8XMwwrFLjnHnVhCNMJJGpnq6mimfm2x9Lujpp3g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages