Killing a nasty performance bug. if snipts was calling .objects.all() before paginate had a chance to splice QS

master
Nick Sergeant 2012-03-06 11:29:43 -05:00
parent dc2d4bab6f
commit dbcf7ba3d1
2 changed files with 5 additions and 2 deletions

View File

@ -27,6 +27,7 @@ def list_public(request, tag_slug=None):
snipts = snipts.filter(tags__name__in=[tag_slug])
return {
'has_snipts': True,
'public': True,
'snipts': snipts,
'tags': tags,
@ -60,6 +61,7 @@ def list_user(request, username, tag_slug=None):
snipts = snipts.filter(tags__name__in=[tag_slug])
return {
'has_snipts': True,
'public': public,
'snipts': snipts,
'tags': tags,
@ -94,6 +96,7 @@ def detail(request, username, snipt_slug):
tags = tags.order_by('-count', 'name')
return {
'has_snipts': True,
'public': public,
'snipt': snipt,
'tags': tags,

View File

@ -139,7 +139,7 @@
<div class="left-y ruler"></div>
<div class="right-y ruler"></div>
</section>
{% if snipts or snipt %}
{% if has_snipts %}
<section class="main group hidden" id="main-edit"></section>
{% endif %}
<div class="modal hide" id="keyboard-shortcuts">
@ -232,7 +232,7 @@
</table>
</div>
</div>
{% if snipts or snipt %}
{% if has_snipts %}
{% verbatim %}
<div class="hidden" id="templates">
<script id="snipt" type="text/html">