Commit 44c0fb2b55d4348185a9bf9af6fcd1fb76023ce3
1 parent
92ac3c87
Exists in
master
and in
39 other branches
Fixing config
Showing
2 changed files
with
25 additions
and
16 deletions
Show diff stats
src/colab/custom_settings.py
| ... | ... | @@ -57,6 +57,17 @@ SOLR_BASE_QUERY = """ |
| 57 | 57 | ((Type:changeset OR Type:ticket OR Type:wiki OR Type:thread) AND Title:["" TO *]) |
| 58 | 58 | """ |
| 59 | 59 | |
| 60 | +TEMPLATE_CONTEXT_PROCESSORS = ( | |
| 61 | + 'django.contrib.auth.context_processors.auth', | |
| 62 | + 'django.core.context_processors.debug', | |
| 63 | + 'django.core.context_processors.i18n', | |
| 64 | + 'django.core.context_processors.media', | |
| 65 | + 'django.core.context_processors.static', | |
| 66 | + 'django.core.context_processors.tz', | |
| 67 | + 'django.contrib.messages.context_processors.messages', | |
| 68 | + 'django.core.context_processors.request', | |
| 69 | +) | |
| 70 | + | |
| 60 | 71 | try: |
| 61 | 72 | from local_settings import * |
| 62 | 73 | except ImportError: | ... | ... |
src/super_archives/views.py
| ... | ... | @@ -6,7 +6,7 @@ from django.http import Http404 |
| 6 | 6 | from django.template import RequestContext |
| 7 | 7 | from django.core.paginator import Paginator |
| 8 | 8 | from django.core.exceptions import ObjectDoesNotExist |
| 9 | -from django.shortcuts import render_to_response, get_list_or_404 | |
| 9 | +from django.shortcuts import render, get_list_or_404 | |
| 10 | 10 | |
| 11 | 11 | from .models import MailingList, Thread |
| 12 | 12 | |
| ... | ... | @@ -16,39 +16,38 @@ def thread(request, mailinglist, thread_token): |
| 16 | 16 | try: |
| 17 | 17 | first_message = queries.get_first_message_in_thread(mailinglist, thread_token) |
| 18 | 18 | except ObjectDoesNotExist: |
| 19 | - raise Http404 | |
| 19 | + raise Http404 | |
| 20 | 20 | order_by = request.GET.get('order') |
| 21 | 21 | if order_by == 'voted': |
| 22 | 22 | msgs_query = queries.get_messages_by_voted() |
| 23 | 23 | else: |
| 24 | 24 | msgs_query = queries.get_messages_by_date() |
| 25 | - | |
| 25 | + | |
| 26 | 26 | msgs_query = msgs_query.filter(thread__subject_token=thread_token) |
| 27 | 27 | msgs_query = msgs_query.filter(thread__mailinglist__name=mailinglist) |
| 28 | 28 | emails = msgs_query.exclude(id=first_message.id) |
| 29 | - | |
| 29 | + | |
| 30 | 30 | total_votes = first_message.votes_count() |
| 31 | 31 | for email in emails: |
| 32 | 32 | total_votes += email.votes_count() |
| 33 | 33 | |
| 34 | 34 | # Update relevance score |
| 35 | 35 | query = Thread.objects.filter(mailinglist__name=mailinglist) |
| 36 | - thread = query.get(subject_token=thread_token) | |
| 36 | + thread = query.get(subject_token=thread_token) | |
| 37 | 37 | thread.update_score() |
| 38 | - | |
| 38 | + | |
| 39 | 39 | template_data = { |
| 40 | 40 | 'first_msg': first_message, |
| 41 | 41 | 'emails': [first_message] + list(emails), |
| 42 | 42 | 'pagehits': queries.get_page_hits(request.path_info), |
| 43 | 43 | 'total_votes': total_votes, |
| 44 | 44 | } |
| 45 | - | |
| 46 | - return render_to_response('message-thread.html', template_data, | |
| 47 | - RequestContext(request)) | |
| 45 | + | |
| 46 | + return render(request, 'message-thread.html', template_data) | |
| 48 | 47 | |
| 49 | 48 | |
| 50 | 49 | def list_messages(request): |
| 51 | - | |
| 50 | + | |
| 52 | 51 | selected_list = request.GET.get('list') |
| 53 | 52 | |
| 54 | 53 | order_by = request.GET.get('order') |
| ... | ... | @@ -56,20 +55,20 @@ def list_messages(request): |
| 56 | 55 | threads = queries.get_hottest_threads() |
| 57 | 56 | else: |
| 58 | 57 | threads = queries.get_latest_threads() |
| 59 | - | |
| 58 | + | |
| 60 | 59 | mail_list = request.GET.get('list') |
| 61 | 60 | if mail_list: |
| 62 | 61 | threads = threads.filter(mailinglist__name=mail_list) |
| 63 | - | |
| 62 | + | |
| 64 | 63 | paginator = Paginator(threads, 16) |
| 65 | 64 | try: |
| 66 | 65 | page = int(request.GET.get('p', '1')) |
| 67 | 66 | except ValueError: |
| 68 | 67 | page = 1 |
| 69 | 68 | threads = paginator.page(page) |
| 70 | - | |
| 69 | + | |
| 71 | 70 | lists = MailingList.objects.all() |
| 72 | - | |
| 71 | + | |
| 73 | 72 | template_data = { |
| 74 | 73 | 'lists': lists, |
| 75 | 74 | 'n_results': paginator.count, |
| ... | ... | @@ -77,5 +76,4 @@ def list_messages(request): |
| 77 | 76 | 'selected_list': selected_list, |
| 78 | 77 | 'order_by': order_by, |
| 79 | 78 | } |
| 80 | - return render_to_response('message-list.html', template_data, | |
| 81 | - RequestContext(request)) | |
| 79 | + return render(request, 'message-list.html', template_data) | ... | ... |