Permalink
Browse files

unicode and description cleanup

  • Loading branch information...
1 parent ceea481 commit fe05165062e060031cb315bf8f593963ddafb419 @stefanfoulis stefanfoulis committed Dec 10, 2012
Showing with 15 additions and 13 deletions.
  1. +2 −2 stacks/cms_plugins.py
  2. +12 −9 stacks/models.py
  3. +1 −2 stacks/templatetags/stack_tags.py
View
@@ -10,15 +10,15 @@
class StackPlugin(CMSPluginBase):
model = StackLink
name = _("Stack")
-
render_template = "cms/plugins/stacks.html"
+ admin_preview = False
def render(self, context, instance, placeholder):
# TODO: once we drop 2.3.x support we can just use the "render_plugin" templatetag
# instead of rendering html here.
plugins = get_plugins(context['request'], instance.stack.content)
processors = ()
- html_content = mark_safe("".join(render_plugins(plugins, context, placeholder, processors)))
+ html_content = mark_safe(u"".join(render_plugins(plugins, context, placeholder, processors)))
context.update({
'instance': instance,
'placeholder': placeholder,
View
@@ -3,30 +3,33 @@
from cms.models.fields import PlaceholderField
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
-from django.conf import settings
class Stack(models.Model):
- name = models.CharField(max_length=255, blank=True, default='', verbose_name=_("name"))
- code = models.CharField(max_length=255, unique=True, blank=True)
- content = PlaceholderField(slotname='stack_content', verbose_name=_('content'), related_name='stacks_contents')
+ name = models.CharField(
+ verbose_name=_(u'stack name'), max_length=255, blank=True, default='',
+ help_text=_(u'Descriptive name to identify this stack. Not displayed to users.'))
+ code = models.CharField(
+ verbose_name=_(u'stack code'), max_length=255, unique=True, blank=True,
+ help_text=_(u'To render the stack in templates.'))
+ content = PlaceholderField(
+ slotname=u'stack_content', verbose_name=_(u'stack content'), related_name='stacks_contents')
class Meta:
- verbose_name = _('stack')
- verbose_name_plural = _('stacks')
- unique_together = ('code',)
+ verbose_name = _(u'stack')
+ verbose_name_plural = _(u'stacks')
def __unicode__(self):
return self.name
def clean(self):
# TODO: check for clashes if the random code is already taken
if not self.code:
- self.code = u"stack-%s" % uuid.uuid4()
+ self.code = u'stack-%s' % uuid.uuid4()
class StackLink(CMSPlugin):
- stack = models.ForeignKey(Stack, verbose_name=_("stack"))
+ stack = models.ForeignKey(Stack, verbose_name=_(u'stack'))
def __unicode__(self):
return self.stack.name
@@ -1,7 +1,6 @@
-from classytags.arguments import Argument, KeywordArgument
+from classytags.arguments import Argument
from classytags.core import Tag, Options
from django import template
-from django.utils import translation
from django.utils.safestring import mark_safe
from cms.plugin_rendering import render_plugins
from cms.plugins.utils import get_plugins

0 comments on commit fe05165

Please sign in to comment.