fix name of unittest tearDown() method
[mygpo.git] / mygpo / share / models.py
blob3e3c20de706e0f437a6d12ee474d5b51339240e5
1 from random import random
3 from couchdbkit.ext.django.schema import *
5 from django.core.urlresolvers import reverse
7 from mygpo.core.proxy import DocumentABCMeta
8 from mygpo.users.models import RatingMixin
9 from mygpo.flattr import FlattrThing
13 class PodcastList(Document, RatingMixin):
14 """ A list of Podcasts that a user creates for the purpose of sharing """
16 __metaclass__ = DocumentABCMeta
18 title = StringProperty(required=True)
19 slug = StringProperty(required=True)
20 podcasts = StringListProperty()
21 user = StringProperty(required=True)
22 random_key = FloatProperty(default=random)
23 created_timestamp = IntegerProperty()
26 def get_flattr_thing(self, domain, username):
27 """ Returns a "Thing" which can be flattred by other Flattr users """
28 return FlattrThing(
29 url = reverse('list-show', args=[username, self.slug]),
30 title = self.title,
31 description = u'A collection of podcasts about "%s" by %s user %s' % (self.title, domain, username),
32 category = u'audio',
33 hidden = None,
34 tags = None,
35 language = None,
39 def __repr__(self):
40 return '<{cls} "{title}" by {user}>'.format(
41 cls=self.__class__.__name__, title=self.title, user=self.user)