# HG changeset patch # User Brian Neal # Date 1376616902 18000 # Node ID 91de9b15b410d831e77ba66fc658338c88635686 # Parent 89b240fe9297f2f45f99a1a5c67c34825cf0f776 For Django 1.5.2: select_related's depth argument is deprecated. diff -r 89b240fe9297 -r 91de9b15b410 forums/management/commands/topic_export.py --- a/forums/management/commands/topic_export.py Thu Aug 15 20:14:33 2013 -0500 +++ b/forums/management/commands/topic_export.py Thu Aug 15 20:35:02 2013 -0500 @@ -48,7 +48,7 @@ except Topic.DoesNotExist: raise CommandError('topic ID does not exist') - posts = topic.posts.select_related(depth=1) + posts = topic.posts.select_related('user') try: content = render_to_string(template_name, {'topic': topic, 'posts': diff -r 89b240fe9297 -r 91de9b15b410 forums/views/main.py --- a/forums/views/main.py Thu Aug 15 20:14:33 2013 -0500 +++ b/forums/views/main.py Thu Aug 15 20:35:02 2013 -0500 @@ -1,5 +1,6 @@ """ Views for the forums application. + """ import collections import datetime @@ -169,7 +170,7 @@ topic.view_count = F('view_count') + 1 topic.save(force_update=True) - posts = topic.posts.select_related(depth=1) + posts = topic.posts.select_related('user') paginator = create_post_paginator(posts) page_num = get_page_num(request) @@ -260,7 +261,7 @@ topic_url = reverse('forums-topic_index', kwargs={'id': id}) if request.user.is_authenticated(): - topic = get_object_or_404(Topic.objects.select_related(depth=1), pk=id) + topic = get_object_or_404(Topic.objects.select_related('forum', 'user'), pk=id) try: tlv = TopicLastVisit.objects.get(user=request.user, topic=topic) except TopicLastVisit.DoesNotExist: @@ -290,7 +291,7 @@ This view shows the latest (last) post in a given topic. """ - topic = get_object_or_404(Topic.objects.select_related(depth=1), pk=id) + topic = get_object_or_404(Topic.objects.select_related('forum', 'user'), pk=id) if topic.last_post: return _goto_post(topic.last_post)