Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

better unicode methods

  • Loading branch information...
commit fe79a8cf53a7dde5f0810643cc2d7ca702d4819b 1 parent d8f7e23
@piquadrat piquadrat authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 cmsplugin_text_ng/models.py
View
6 cmsplugin_text_ng/models.py
@@ -47,6 +47,9 @@ class TextNGVariableBase(models.Model):
text_ng = models.ForeignKey(TextNG, related_name='+')
label = models.CharField(_('label'), max_length=20, validators=[RegexValidator(regex='[_a-z]+', message=_('Only lower case characters.'))])
+ def __unicode__(self):
+ return self.label
+
class Meta:
abstract = True
unique_together = ('text_ng', 'label')
@@ -55,6 +58,9 @@ class Meta:
class TextNGVariableText(TextNGVariableBase):
value = models.TextField(_('value'), null=True, blank=True)
+ def __unicode__(self):
+ return self.label + (' (%s)' % self.value if self.value else '')
+
class Meta:
verbose_name = _('text')
verbose_name_plural = _('texts')
Please sign in to comment.
Something went wrong with that request. Please try again.