Plugins (feincms3.plugins)

Historical note

The content types in FeinCMS had ways to process requests and responses themselves, the .process() and .finalize() methods. feincms3 plugins do not offer this. The feincms3 way to achieve the same thing is by using apps or by adding the functionality in your own views (which are much simpler than the view in FeinCMS was).


Uses the Noembed oEmbed service to embed (almost) arbitrary URLs. Depends on requests.

class feincms3.plugins.external.External(*args, **kwargs)[source]

External content plugin

class feincms3.plugins.external.ExternalInline(parent_model, admin_site)[source]
class feincms3.plugins.external.NoembedValidationForm(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]

Tries fetching the oEmbed code for the given URL when cleaning form data

This isn’t active by default. If you want to validate URLs you should use the following snippet:

from app.pages import models
from feincms3 import plugins

class SomeAdmin(...):
    inlines = [

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

property media

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

feincms3.plugins.external.oembed_html(url, **kwargs)[source]

Wraps oembed_json(), but only returns the HTML part of the OEmbed response.

The return value is always either a HTML fragment or an empty string.

feincms3.plugins.external.oembed_json(url, *, cache_failures=True, force_refresh=False, params=None)[source]

Asks Noembed for the embedding HTML code for arbitrary URLs. Sites supported include YouTube, Vimeo, Twitter and many others.

Successful embeds are always cached for 30 days.

Failures are cached if cache_failures is True (the default). The durations are as follows:

  • Connection errors are cached 60 seconds with the hope that the connection failure is only transient.

  • HTTP errors codes and responses in an unexpected format (no JSON) are cached for 24 hours.

The return value is always a dictionary, but it may be empty.

feincms3.plugins.external.render_external(plugin, context=None, **kwargs)[source]

Render the plugin, embedding it in the appropriate markup for Foundation’s responsive-embed element

The HTML embed code is generated using oembed_html(). Maybe you want to take a look at feincms3.embedding for a less versatile but much faster alternative.


Plugin providing a simple textarea where raw HTML, CSS and JS code can be entered.

Most useful for people wanting to shoot themselves in the foot.

class feincms3.plugins.html.HTML(*args, **kwargs)[source]

Raw HTML plugin

class feincms3.plugins.html.HTMLInline(parent_model, admin_site)[source]

Just available for consistency, absolutely no difference to a standard ContentEditorInline.

get_fieldsets(request, obj=None)[source]

Hook for specifying fieldsets.

feincms3.plugins.html.render_html(plugin, context=None, **kwargs)[source]

Return the HTML code as safe string so that it is not escaped. Of course the contents are not guaranteed to be safe at all


Provides an image plugin with support for setting the primary point of interest. This is very useful especially when cropping images. Depends on django-imagefield.

class feincms3.plugins.image.Image(*args, **kwargs)[source]

Image plugin

class feincms3.plugins.image.ImageInline(parent_model, admin_site)[source]

Image inline

feincms3.plugins.image.render_image(plugin, context=None, **kwargs)[source]

Return a simple, unscaled version of the image

Rich text

class feincms3.plugins.richtext.RichText(*args, **kwargs)[source]

Rich text plugin.

feincms3.inline_ckeditor.InlineCKEditorField does all the heavy lifting.

class feincms3.plugins.richtext.RichTextInline(parent_model, admin_site)[source]
feincms3.plugins.richtext.render_richtext(plugin, context=None, **kwargs)[source]

Return the text of the rich text plugin as a safe string (mark_safe)


Plugin for including template snippets through the CMS

class feincms3.plugins.snippet.Snippet(*args, **kwargs)[source]

Template snippet plugin

static fill_template_name_choices(sender, **kwargs)[source]

Fills in the choices for template_name from the TEMPLATES class variable. This method is a receiver of Django’s class_prepared signal.

classmethod register_with(renderer, **kwargs)[source]

This helper registers the snippet plugin with a TemplatePluginRenderer while adding support for template-specific context functions. The templates specified using the TEMPLATES class variable may contain a callable which receives the plugin instance and the template context and returns a context dictionary.

class feincms3.plugins.snippet.SnippetInline(parent_model, admin_site)[source]

Snippet inline does nothing special, it simply exists for consistency with the other feincms3 plugins

feincms3.plugins.snippet.render_snippet(plugin, context=None, **kwargs)[source]

Renders the selected template using render_to_string

Deprecated plugins

Rich text support using django-ckeditor

Provides a rich text area whose content is automatically cleaned using a very restrictive allowlist of tags and attributes.

Depends on django-ckeditor and html-sanitizer.

class feincms3.plugins.old_richtext.RichText(*args, **kwargs)[source]

Rich text plugin

To use this, a django-ckeditor configuration named richtext-plugin is required. See the section HTML cleansing for the recommended configuration.

class feincms3.plugins.old_richtext.RichTextInline(parent_model, admin_site)[source]

The only difference with the standard ContentEditorInline is that this inline adds the feincms3/plugin-ckeditor.css file which adjusts the width of the django-ckeditor widget inside the content editor.

feincms3.plugins.old_richtext.render_richtext(plugin, context=None, **kwargs)[source]

Return the text of the rich text plugin as a safe string (mark_safe)