-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmodels.py
More file actions
24 lines (20 loc) · 858 Bytes
/
models.py
File metadata and controls
24 lines (20 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from cms.models.pluginmodel import CMSPlugin
@python_2_unicode_compatible
class Quote(models.Model):
quote_text = models.TextField(_(u'Quote Text'))
author = models.CharField(_(u'Author'), max_length=255)
author_url = models.URLField(_(u'Author URL'), null=True, blank=True, default=None, max_length=255)
def __str__(self):
return '[%s] %s...' % (self.author, self.quote_text[:20])
@python_2_unicode_compatible
class RandomQuotePlugin(CMSPlugin):
amount = models.IntegerField(
default=1,
help_text=_('The number of random quotes to be displayed.')
)
def __str__(self):
return 'displaying %s' % (self.amount)