Mercurial > public > sg101
comparison gpp/shoutbox/views.py @ 118:a20b2c492d55
Reduced some sql queries by adding a select_related and monkey patching user profiles onto a user list in shoutbox and the bio/member's list, respectively.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 24 Oct 2009 02:39:19 +0000 |
parents | 62eb9cbbcffc |
children | e1d1a70d312d |
comparison
equal
deleted
inserted
replaced
117:a3633f39f3ce | 118:a20b2c492d55 |
---|---|
50 context_instance = RequestContext(request)) | 50 context_instance = RequestContext(request)) |
51 | 51 |
52 | 52 |
53 def view_history(request, page=1): | 53 def view_history(request, page=1): |
54 """This view allows one to view the shoutbox history.""" | 54 """This view allows one to view the shoutbox history.""" |
55 paginator = DiggPaginator(Shout.objects.all(), SHOUTS_PER_PAGE, body=5, tail=3, margin=3, padding=2) | 55 paginator = DiggPaginator(Shout.objects.all().select_related(), |
56 SHOUTS_PER_PAGE, body=5, tail=3, margin=3, padding=2) | |
56 try: | 57 try: |
57 the_page = paginator.page(int(page)) | 58 the_page = paginator.page(int(page)) |
58 except InvalidPage: | 59 except InvalidPage: |
59 raise Http404 | 60 raise Http404 |
60 | 61 |