[Oi-commits] trunk/forum - 15 / 15 + 1 != 2 (15th post is not in second page)...
Ahmet AYGUN
me at ahmetaygun.net
Tue Sep 21 19:40:43 EEST 2010
Posts_count a gerek yok posts.count() kullanalim orda da ;)
21.Eyl.2010 tarihinde 19:32 saatinde, Gökmen Görgen <oi-svn at pardus.org.
tr> şunları yazdı:
> Author: gkmngrgn
> Date: Tue Sep 21 19:32:11 2010
> New Revision: 3518
>
> Modified:
> trunk/forum/models.py
> Log:
> 15 / 15 + 1 != 2 (15th post is not in second page).
>
> ---
> models.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> Modified: trunk/forum/models.py
> =================================================================
> --- trunk/forum/models.py (original)
> +++ trunk/forum/models.py Tue Sep 21 19:32:11 2010
> @@ -43,8 +43,13 @@
> """Use topic/forum.get_latest_post_url whenever you can"""
>
> posts = self.topic.post_set.all().order_by('created')
> + posts_count = posts.count()
>
> - page = posts.count() / POSTS_PER_PAGE + 1
> + if posts_count == POSTS_PER_PAGE:
> + page = 1
> +
> + else:
> + page = posts.count() / POSTS_PER_PAGE + 1
>
> return '/forum/%s/%s/?page=%s#post%s' %
> (self.topic.forum.slug, self.topic.id, page, self.id)
>
> _______________________________________________
> Oi-commits mailing list
> Oi-commits at pardus.org.tr
> http://liste.pardus.org.tr/mailman/listinfo/oi-commits
More information about the Oi-commits
mailing list