Skip to content

A multiple selection checkboxes list grouped by an attribute value and showed one group at a time by a dropdown menu.

Notifications You must be signed in to change notification settings

nastasi-oq/django-chained-multi-checkboxes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USAGE

ModelChainedMultipleChoiceField allows you to add a grouped list of checkboxes, what group shows is managed by a dropdown menu associated to it with the parent_field attribute that is related to the form attribute.

To work properly you must pass the queryset associated, it will be grouped by order_fields, put the grouping attribute as first in this tuple.

From application forms.py:

  ingredients = ModelChainedMultipleChoiceField(parent_field='form_taste', order_fields=('taste', 'name'),
                                                queryset=Ingredient.objects.all(),
                                                required=False)

TODO

  • make 'ALL' checkbox optional
  • documentation

DONE

  • from .group attribute to a dynamic field
  • dynamic order_by instead of Meta ordering
  • add 'ALL' checkbox utility per group
  • add another example with nested inlines
  • manage hidden checkbox when associated group is selected
  • add the hidden group
  • pass a new attribute "is_hidden"

About

A multiple selection checkboxes list grouped by an attribute value and showed one group at a time by a dropdown menu.

Resources

Stars

Watchers

Forks

Packages

No packages published