X-Git-Url: https://git.mdrn.pl/turniej.git/blobdiff_plain/574e798cbd5cd6311fe0d5ba857c216939ed71dd..0c7227fce830c6ca7631d4a2a6dcd8b108ee9316:/apps/poetry/models.py diff --git a/apps/poetry/models.py b/apps/poetry/models.py index ef8bf94..63bf8f2 100644 --- a/apps/poetry/models.py +++ b/apps/poetry/models.py @@ -53,6 +53,9 @@ class Poet(models.Model): p.save() return self.poem_set.filter(for_contest=True) + def contest_poems(self): + return self.poem_set.filter(in_contest=True) + class Poem(models.Model): slug = models.SlugField(max_length=50, db_index=True) @@ -68,8 +71,7 @@ class Poem(models.Model): def __unicode__(self): oneliner = u"%s, %s" % (self.poet.name, self.pretty_title()) - if not self.title: - oneliner += u" [%s…]" % self.text[:20] + oneliner += u" [%s…]" % (u" ".join(self.text.split()[:5])) return oneliner def get_absolute_url(self):