Mercurial > public > sg101
comparison forums/views/subscriptions.py @ 1032:e932f2ecd4a7
Django 1.8 warnings / tech debt cleanup.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Dec 2015 15:10:55 -0600 |
parents | 4aadaf3bc234 |
children |
comparison
equal
deleted
inserted
replaced
1031:e1c03da72818 | 1032:e932f2ecd4a7 |
---|---|
6 from django.core.urlresolvers import reverse | 6 from django.core.urlresolvers import reverse |
7 from django.http import HttpResponseRedirect | 7 from django.http import HttpResponseRedirect |
8 from django.http import Http404 | 8 from django.http import Http404 |
9 from django.template.loader import render_to_string | 9 from django.template.loader import render_to_string |
10 from django.shortcuts import get_object_or_404 | 10 from django.shortcuts import get_object_or_404 |
11 from django.shortcuts import render_to_response | 11 from django.shortcuts import render |
12 from django.template import RequestContext | |
13 from django.views.decorators.http import require_POST | 12 from django.views.decorators.http import require_POST |
14 | 13 |
15 from forums.models import Topic | 14 from forums.models import Topic |
16 import forums.permissions as perms | 15 import forums.permissions as perms |
17 from core.functions import send_mail | 16 from core.functions import send_mail |
73 @login_required | 72 @login_required |
74 def subscription_status(request, topic_id): | 73 def subscription_status(request, topic_id): |
75 """Display the subscription status for the given topic.""" | 74 """Display the subscription status for the given topic.""" |
76 topic = get_object_or_404(Topic.objects.select_related(), id=topic_id) | 75 topic = get_object_or_404(Topic.objects.select_related(), id=topic_id) |
77 is_subscribed = request.user in topic.subscribers.all() | 76 is_subscribed = request.user in topic.subscribers.all() |
78 return render_to_response('forums/subscription_status.html', { | 77 return render(request, 'forums/subscription_status.html', { |
79 'topic': topic, | 78 'topic': topic, |
80 'is_subscribed': is_subscribed, | 79 'is_subscribed': is_subscribed, |
81 }, | 80 }) |
82 context_instance=RequestContext(request)) | |
83 | 81 |
84 | 82 |
85 @login_required | 83 @login_required |
86 def manage_subscriptions(request): | 84 def manage_subscriptions(request): |
87 """Display a user's topic subscriptions, and allow them to be deleted.""" | 85 """Display a user's topic subscriptions, and allow them to be deleted.""" |
112 try: | 110 try: |
113 page = paginator.page(page_num) | 111 page = paginator.page(page_num) |
114 except InvalidPage: | 112 except InvalidPage: |
115 raise Http404 | 113 raise Http404 |
116 | 114 |
117 return render_to_response('forums/manage_topics.html', { | 115 return render(request, 'forums/manage_topics.html', { |
118 'page_title': 'Topic Subscriptions', | 116 'page_title': 'Topic Subscriptions', |
119 'description': 'The forum topics you are currently subscribed to are listed below.', | 117 'description': 'The forum topics you are currently subscribed to are listed below.', |
120 'page': page, | 118 'page': page, |
121 }, | 119 }) |
122 context_instance=RequestContext(request)) |