From: Kriti Godey Date: Fri, 23 Jul 2010 14:06:51 +0000 (+0530) Subject: Added "entry_dates" method to model to provide distinct yearly, monthly and daily... X-Git-Tag: philo-0.9~44^2~2 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/d8d56d3a2425875ad09dd1f80b7cda25feeda953?ds=sidebyside;hp=--cc Added "entry_dates" method to model to provide distinct yearly, monthly and daily dates for posts. --- d8d56d3a2425875ad09dd1f80b7cda25feeda953 diff --git a/contrib/penfield/models.py b/contrib/penfield/models.py index eede5a4..0a46c54 100644 --- a/contrib/penfield/models.py +++ b/contrib/penfield/models.py @@ -15,6 +15,11 @@ class Blog(Entity, Titled): def entry_tags(self): """ Returns a QuerySet of Tags that are used on any entries in this blog. """ return Tag.objects.filter(blogentries__blog=self).distinct() + + @property + def entry_dates(self): + dates = {'year': self.entries.dates('date', 'year', order='DESC'), 'month': self.entries.dates('date', 'month', order='DESC'), 'day': self.entries.dates('date', 'day', order='DESC')} + return dates register_value_model(Blog)