diff --git a/plinth/forms.py b/plinth/forms.py index 0358080e9..56d499b60 100644 --- a/plinth/forms.py +++ b/plinth/forms.py @@ -87,32 +87,34 @@ class LanguageSelectionForm(LanguageSelectionFormMixin, forms.Form): language = LanguageSelectionFormMixin.language -class CheckboxSelectMultipleWithDisabled(forms.widgets.CheckboxSelectMultiple): +class CheckboxSelectMultipleWithReadOnly(forms.widgets.CheckboxSelectMultiple): """ - Subclass of Django's checkbox select multiple widget that allows disabling checkbox-options. - To disable an option, pass a dict instead of a string for its label, - of the form: {'label': 'option label', 'disabled': True} + Subclass of Django's CheckboxSelectMultiple widget that allows setting + individual fields as readonly + To mark a feature as readonly an option, pass a dict instead of a string + for its label, of the form: {'label': 'option label', 'disabled': True} Derived from https://djangosnippets.org/snippets/2786/ """ def render(self, name, value, attrs=None, choices=(), renderer=None): - if value is None: value = [] + if value is None: + value = [] final_attrs = self.build_attrs(attrs) output = [u'