hi scanner,

i hope i understood correct...

i have an newsitem apps with comments, the comments are paginated by
50.

this is my get_absolute_url() for the comments:

    def get_absolute_url(self):
        comment_ids = [c.id for c in
self.newsitem.comment_set.iterator()]
        comment_ids.reverse()
        comment_rank = comment_ids.index(self.id) + 1
        paginate_by = 50
        page = (comment_rank-1) / paginate_by + 1
        if page > 1:
            pagestring = "seite-%s/" % page
        else:
            pagestring = ""
        return "/%s/%s#%s" % (self.newsitem.slug, pagestring, self.id)

not pretty, and has one main problem, each comment will result in a
new query..

i would like to add an comment_url on the comments app and save the
link upon comment-creation, but couldnt figure that out so far.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to