The content types in FeinCMS
had ways to process requests and responses themselves, the
.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.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 = [ ... plugins.external.ExternalInline.create( model=models.External, form=plugins.external.NoembedValidationForm, ), ... ]
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]#
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
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, **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.embeddingfor 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.HTMLInline(parent_model, admin_site)[source]#
Just available for consistency, absolutely no difference to a standard
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.richtext.RichText(*args, **kwargs)[source]#
Rich text plugin.
feincms3.inline_ckeditor.InlineCKEditorFielddoes all the heavy lifting.
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
TEMPLATESclass variable. This method is a receiver of Django’s
- classmethod register_with(renderer, **kwargs)[source]#
This helper registers the snippet plugin with a
TemplatePluginRendererwhile adding support for template-specific context functions. The templates specified using the
TEMPLATESclass 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
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-pluginis required. See the section
HTML cleansingfor the recommended configuration.
- class feincms3.plugins.old_richtext.RichTextInline(parent_model, admin_site)[source]#
The only difference with the standard
ContentEditorInlineis that this inline adds the
feincms3/plugin-ckeditor.cssfile which adjusts the width of the django-ckeditor widget inside the content editor.