# HG changeset patch # User Brian Neal # Date 1270873944 0 # Node ID 2baadae33f2eafb307cda307dca205ff2666deb4 # Parent 893b6d462cf9619aa5009616ea1660e73c4dbac4 Got autocomplete working for the member search. Updated django and ran into a bug where url tags with comma separated kwargs starting consuming tons of CPU throughput. The work-around is to cut over to using spaces between arguments. This is now allowed to be consistent with other tags. Did some query optimization for the news app. diff -r 893b6d462cf9 -r 2baadae33f2e gpp/bio/forms.py --- a/gpp/bio/forms.py Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/bio/forms.py Sat Apr 10 04:32:24 2010 +0000 @@ -120,6 +120,12 @@ """ username = forms.CharField(max_length=30, widget=AutoCompleteUserInput()) + class Media: + css = { + 'all': settings.GPP_THIRD_PARTY_CSS['jquery-ui'] + } + js = settings.GPP_THIRD_PARTY_JS['jquery-ui'] + def clean_username(self): username = self.cleaned_data['username'] try: diff -r 893b6d462cf9 -r 2baadae33f2e gpp/news/views.py --- a/gpp/news/views.py Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/news/views.py Sat Apr 10 04:32:24 2010 +0000 @@ -40,7 +40,7 @@ ####################################################################### def index(request, page=1): - stories = Story.objects.all() + stories = Story.objects.all().select_related() paginator = create_paginator(stories) try: the_page = paginator.page(int(page)) @@ -87,10 +87,10 @@ ####################################################################### def category_index(request): - categories = Category.objects.all() + categories = Category.objects.all().select_related() cat_list = [] for cat in categories: - cat_list.append((cat, cat.story_set.all()[:10])) + cat_list.append((cat, cat.story_set.defer('tags')[:10])) return render_to_response('news/category_index.html', { 'cat_list': cat_list, @@ -215,7 +215,7 @@ def tag(request, tag_name, page=1): tag = get_object_or_404(Tag, name=tag_name) - stories = TaggedItem.objects.get_by_model(Story, tag) + stories = TaggedItem.objects.get_by_model(Story.objects.all().select_related(), tag) paginator = create_paginator(stories) try: the_page = paginator.page(int(page)) @@ -227,7 +227,7 @@ 'page': the_page, 'search_form': SearchNewsForm(), }, - context_instance = RequestContext(request)) + context_instance=RequestContext(request)) ####################################################################### diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/bio/members.html --- a/gpp/templates/bio/members.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/bio/members.html Sat Apr 10 04:32:24 2010 +0000 @@ -11,9 +11,9 @@ particular user? Try our member search.

{% if page.object_list %} diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/downloads/download_list.html --- a/gpp/templates/downloads/download_list.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/downloads/download_list.html Sat Apr 10 04:32:24 2010 +0000 @@ -16,13 +16,13 @@ {% if page.object_list %} diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/downloads/index.html --- a/gpp/templates/downloads/index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/downloads/index.html Sat Apr 10 04:32:24 2010 +0000 @@ -13,7 +13,7 @@
{% for category in categories %}
-{{ category.title }} +{{ category.title }} ({{ category.count }})

{{ category.description }}

diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/archive_index.html --- a/gpp/templates/news/archive_index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/archive_index.html Sat Apr 10 04:32:24 2010 +0000 @@ -10,7 +10,7 @@ {% if dates %} diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/category_index.html --- a/gpp/templates/news/category_index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/category_index.html Sat Apr 10 04:32:24 2010 +0000 @@ -12,7 +12,7 @@ {% for category, story_set in cat_list %}

{{ category.title }}

-

+

{{ category.title }}

diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/index.html --- a/gpp/templates/news/index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/index.html Sat Apr 10 04:32:24 2010 +0000 @@ -1,5 +1,4 @@ {% extends 'news/base.html' %} -{% load tagging_tags %} {% block title %}News: {{ title }}{% endblock %} {% block news_css %} @@ -15,7 +14,6 @@ {% if page.object_list %} {% for story in page.object_list %} - {% tags_for_object story as story_tags %} {% include 'news/story_summary.html' %} {% endfor %}
diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/story.html --- a/gpp/templates/news/story.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/story.html Sat Apr 10 04:32:24 2010 +0000 @@ -19,7 +19,7 @@
- + {{ story.category.title }} {{ story.short_text|safe }} @@ -29,7 +29,7 @@ {% if story_tags %}

- Category: {{ story.category.title }} + Category: {{ story.category.title }} Story Permalink {% if user.is_authenticated %} @@ -41,7 +41,7 @@ Tags Tags:

diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/story_summary.html --- a/gpp/templates/news/story_summary.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/story_summary.html Sat Apr 10 04:32:24 2010 +0000 @@ -9,7 +9,7 @@
Submitted by {{ story.submitter.username }} on {{ story.date_published|date:"F d, Y" }}.
- + {{ story.category.title }}
@@ -23,7 +23,7 @@ {% endif %}

-Category: {{ story.category.title }} +Category: {{ story.category.title }} Comments {{ comment_count }} comment{{ comment_count|pluralize }} Permalink @@ -32,12 +32,12 @@ alt="Send this story to a friend" title="Send this story to a friend" /> {% endif %}

-{% if story_tags %} +{% if story.tags %}
Tags Tags:
diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/news/tag_index.html --- a/gpp/templates/news/tag_index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/news/tag_index.html Sat Apr 10 04:32:24 2010 +0000 @@ -12,7 +12,7 @@
diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/weblinks/index.html --- a/gpp/templates/weblinks/index.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/weblinks/index.html Sat Apr 10 04:32:24 2010 +0000 @@ -6,7 +6,7 @@

We have {{ total_links }} links in {{ categories.count }} categories.

{% for category in categories %} -
{{ category.title }} +
{{ category.title }} ({{ category.count }})

{{ category.description }}

{% endfor %} diff -r 893b6d462cf9 -r 2baadae33f2e gpp/templates/weblinks/view_links.html --- a/gpp/templates/weblinks/view_links.html Wed Apr 07 01:59:09 2010 +0000 +++ b/gpp/templates/weblinks/view_links.html Sat Apr 10 04:32:24 2010 +0000 @@ -12,11 +12,11 @@ {% if page.object_list %}