Login

Tag "selectmultiple"

Snippet List

CharField powered Tags with ChoiceField widget.

Shell example: >>> pprint.pprint(settings.FORUM_TAGS) ((u'x11', 'Xorg'), (u'pacman', 'Pacman'), (u'aur', 'AUR'), (u'abs', 'ABS'), (u'howto', 'HOWTO'), (u'instalacja', 'Instalacja'), (u'offtopic', 'Offtopic')) >>> t = Thread.objects.all()[0] >>> pprint.pprint(t.tags) [{'slug': u'pacman', 'title': 'Pacman'}, {'slug': u'abs', 'title': 'ABS'}, {'slug': u'howto', 'title': 'HOWTO'}, {'slug': u'instalacja', 'title': 'Instalacja'}, {'slug': u'offtopic', 'title': 'Offtopic'}] >>> t.tags = [{'slug': 'abs'}, {'slug': 'howto'} >>> t.save() >>> t = Thread.objects.get(pk=t.pk) >>> pprint.pprint(t.tags) [{'slug': u'abs', 'title': 'ABS'}, {'slug': u'howto', 'title': 'HOWTO'}] >>> t.tags = ['Offtopic', 'HOWTO'] >>> t.save() >>> t = Thread.objects.get(pk=t.pk) >>> pprint.pprint(t.tags) [{'slug': u'howto', 'title': 'HOWTO'}, {'slug': u'offtopic', 'title': 'Offtopic'}]

  • tag
  • forms
  • field
  • selectmultiple
  • checbox
Read More

TableSelectMultiple Widget

A widget for selecting from a list of `Model` instances using `MultipleChoiceField` which renders a table row for each choice, consisting of a column for a checkbox followed by a column for each item specified in `item_attrs`, which must specify attributes of the objects passed as choices.

  • forms
  • table
  • widget
  • selectmultiple
Read More

2 snippets posted so far.