Feature

Models

class cmsplugin_blocks.models.feature.Feature(*args, **kwargs)[source]

Feature model.

title

Optional title string.

value

Number for order position in item list.

scope

Required feature scope choice. (size, color, extra)

plugins

Optional string of plugin models names divided by a single comma.

Factories

Forms

class cmsplugin_blocks.forms.feature.FeatureForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Admin form to create or change a Feature object.

property media

Return all media required to render the widgets on this form.

class cmsplugin_blocks.forms.feature.FeatureImportForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]

Admin form to choose Feature import options.

clean_json_file()[source]

Open file to validate it as JSON and return its content.

NOTE: This could have been done more robustly with Python library “schema”.

save(commit=True)[source]

Save elligible items from loaded JSON as feature objects.

Parameters:

commit (boolean) – Only save objects if True.

Returns:

A dictionnary with items for effectively created and ignored items from loaded JSON.

Return type:

dict

property media

Return all media required to render the widgets on this form.