Login

Tag "select"

Snippet List

filter/search a newforms select widget

Adds a filter input above a select widget that allows live-filtering on the client-side (no ajax) in Firefox. Example: make_fields_searchable(ModelItemForm, { 'publisher': {'set_size': 8}, 'developer': {'set_size': 8}, 'genre': {}, 'platform': {} })

  • filter
  • newforms
  • search
  • model
  • widgets
  • select
Read More

Choice Field and Select Widget With Optional Optgroups

Renders an select field with some optgroups. Some options can be outside the optgroup(s). The options and labels should be in a tuple with ((label, choices),) where choices is a tuple ((key, value), (key2, value2)). If a label is null or blank, the options will not belong to an opt group.

  • newforms
  • widgets
  • select
  • optgroup
  • option
Read More

Month list for a select drop down

month_ids is a list of months like this... [('Apr07', 'April 2007'), ('Mar07', 'March 2007'), ('Feb07', 'February 2007')] which can be used in a select box like this.. month = forms.ChoiceField(choices=(months))

  • months
  • select
Read More

18 snippets posted so far.