Skip to content

Instantly share code, notes, and snippets.

@ojii
Created May 24, 2011 13:32
Show Gist options
  • Save ojii/988703 to your computer and use it in GitHub Desktop.
Save ojii/988703 to your computer and use it in GitHub Desktop.
new_placeholder_tag.py
from cms.templatetags.cms_tags import Placeholder, PlaceholderOptions
from classytags.helpers import AsTag
from classytags.arguments import Argument, MultiValueArgument
from django import template
register = template.Library()
class NewPlaceholder(AsTag, Placeholder):
name = 'new_placeholder'
options = PlaceholderOptions(
Argument('name', resolve=False),
MultiValueArgument('extra_bits', required=False, resolve=False),
'as',
Argument('varname', required=False, resolve=False),
blocks=[
('endplaceholder', 'nodelist'),
]
)
def get_value(self, context, name, extra_bits, nodelist=None):
return Placeholder.render_tag(self, context, name, extra_bits, nodelist)
register.tag(NewPlaceholder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment