Widgets

Richtemplates provides some widgets helping to use it’s styles and other goodies.

RichCheckboxSelectMultiple

class richtemplates.widgets.RichCheckboxSelectMultiple(extra=True, *args, **kwargs)

Copied from django.forms.CheckboxSelectMultiple with additional img icons tags. With javascript enabled allows to check single box by clicking on it’s row / label / box. Uses nice css highlighting.

Full example:

from django import forms
from richtemplates.widgets import RichCheckboxSelectMultiple
def unslugify(value):
    return value.replace('_', ' ').replace('-', ' ').capitalize()

class MultipleChoicesForm(forms.Form):
    CHOICES = ((key, unslugify(key)) for key in (
        ('view_project'),
        ('edit_project'),
        ('add_project'),
        ('delete_project'),
    ))
    fake_permissions = forms.MultipleChoiceField(choices=CHOICES,
        initial = ['view_project'],
        required = False,
        widget = RichCheckboxSelectMultiple)

Table Of Contents

Previous topic

API Reference

Next topic

Management commands

This Page