Skip to content

Instantly share code, notes, and snippets.

@mkoistinen
Created April 19, 2015 19:17
Show Gist options
  • Save mkoistinen/6e17ff10c093f24539de to your computer and use it in GitHub Desktop.
Save mkoistinen/6e17ff10c093f24539de to your computer and use it in GitHub Desktop.
render_model_span templatetag
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
from cms.templatetags.cms_tags import CMSEditableObject
register = template.Library()
class RenderModelSpan(CMSEditableObject):
"""
Works *exactly* like the {% render_model ... %} templatetag but uses SPANs
instead of DIV to avoid causing visual artefacts when in "content mode".
"""
# Create a new template called: 'site_tags/plugin_span.html'. Copy the
# contents of:
# https://github.com/divio/django-cms/blob/issues/fix_breadcrumbs/cms/\
# templates/cms/toolbar/plugin.html
# into your new template, but change the surrounding HTML tag-pair from
# "DIV" to "SPAN".
edit_template = 'site_tags/plugin_span.html'
name = 'render_model_span'
register.tag(RenderModelSpan)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment