shoop.xtheme.plugins package

Submodules

shoop.xtheme.plugins.consts module

shoop.xtheme.plugins.consts.FALLBACK_LANGUAGE_CODE = '*'

The pseudo-language code used by TranslatedFields and the relevant Plugin API to mark the untranslated/fallback content

shoop.xtheme.plugins.forms module

class shoop.xtheme.plugins.forms.PluginForm(**kwargs)[source]

Bases: django.forms.forms.Form

Base class for plugin configuration forms.

populate()[source]
get_config()[source]

Get the new config dict for a plugin.

Called when the form is valid, akin to django.forms.models.ModelForm.save.

The default implementation just augments the old config with the cleaned data for the form.

Returns:A new JSONable (!) config dict
Return type:dict
base_fields = OrderedDict()
declared_fields = OrderedDict()
media
class shoop.xtheme.plugins.forms.GenericPluginForm(**kwargs)[source]

Bases: shoop.xtheme.plugins.forms.PluginForm

A generic form for Xtheme plugins; populates itself based on fields in the plugin class.

populate()[source]
base_fields = OrderedDict()
declared_fields = OrderedDict()
media
class shoop.xtheme.plugins.forms.TranslatableField(*args, **kwargs)[source]

Bases: django.forms.fields.Field

widget

alias of TranslatableFieldWidget

clean(value)[source]

shoop.xtheme.plugins.image module

class shoop.xtheme.plugins.image.ImagePluginChoiceWidget(attrs=None, clearable=False, empty_text='—')[source]

Bases: shoop.admin.forms.widgets.ImageChoiceWidget

Subclass of ImageChoiceWidget that will not raise an exception if given an invalid initial image ID (in case the image has been deleted)

get_object(value)[source]
media
class shoop.xtheme.plugins.image.ImageIDField(max_value=None, min_value=None, *args, **kwargs)[source]

Bases: django.forms.fields.IntegerField

A custom field that stores the ID value of a Filer image and presents Shoop admin’s image popup widget

widget = <shoop.xtheme.plugins.image.ImagePluginChoiceWidget object>
clean(value)[source]
class shoop.xtheme.plugins.image.ImagePlugin(config)[source]

Bases: shoop.xtheme.TemplatedPlugin

A linkable image plugin

Instantiate a Plugin with the given config dictionary.

Parameters:config (dict) – Dictionary of freeform configuration data
identifier = 'images'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
template_name = 'shoop/xtheme/plugins/image.jinja'
fields = [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7f52fe965898>), ('image_id', <shoop.xtheme.plugins.image.ImageIDField object at 0x7f530058d748>), ('url', <django.forms.fields.URLField object at 0x7f52fe62b080>), ('full_width', <django.forms.fields.BooleanField object at 0x7f52fe3a6860>), ('width', <django.forms.fields.IntegerField object at 0x7f52fe3a6828>), ('height', <django.forms.fields.IntegerField object at 0x7f52fe6320f0>)]
get_context_data(context)[source]

A custom get_context_data that returns the matching filer File

shoop.xtheme.plugins.snippets module

class shoop.xtheme.plugins.snippets.SnippetsPlugin(config)[source]

Bases: shoop.xtheme.Plugin

Simple plugin class for including snippets and resources on the page, mostly for simple integrations.

Instantiate a Plugin with the given config dictionary.

Parameters:config (dict) – Dictionary of freeform configuration data
identifier = 'snippets'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
fields = [('in_place', <django.forms.fields.CharField object at 0x7f5301dc2f60>), ('head_end', <django.forms.fields.CharField object at 0x7f5301dc2dd8>), ('body_start', <django.forms.fields.CharField object at 0x7f5301dc2fd0>), ('body_end', <django.forms.fields.CharField object at 0x7f5301dc2c50>)]
render(context)[source]

shoop.xtheme.plugins.text module

class shoop.xtheme.plugins.text.TextPlugin(config)[source]

Bases: shoop.xtheme.Plugin

Very basic Markdown rendering plugin.

Instantiate a Plugin with the given config dictionary.

Parameters:config (dict) – Dictionary of freeform configuration data
identifier = 'text'
name = 'Text'
fields = [('text', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7f52fee10a90>)]
render(context)[source]

shoop.xtheme.plugins.widgets module

class shoop.xtheme.plugins.widgets.TranslatableFieldWidget(languages, input_widget=<class 'django.forms.widgets.TextInput'>, attrs=None)[source]

Bases: django.forms.widgets.Widget

render(name, value, attrs=None)[source]
id_for_label(id_)[source]
value_from_datadict(data, files, name)[source]
format_output(widget_pairs)[source]
decompress(value)[source]
media
class shoop.xtheme.plugins.widgets.XThemeModelChoiceWidget(attrs=None, choices=())[source]

Bases: django.forms.widgets.Select

render(name, value, attrs=None, choices=())[source]
media
class shoop.xtheme.plugins.widgets.XThemeModelChoiceField(queryset, empty_label='---------', cache_choices=None, required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, *args, **kwargs)[source]

Bases: django.forms.models.ModelChoiceField

widget

alias of XThemeModelChoiceWidget

label_from_instance(obj)[source]

Module contents