Skip to content

Commit

Permalink
Performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Vargas committed May 19, 2016
1 parent 7e0ab45 commit 878353a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions qa/migrations/0005_auto_20160519_1057.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('qa', '0004_answer_updated'),
]

operations = [
migrations.AddField(
model_name='answer',
name='negative_votes',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='answer',
name='positive_votes',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='question',
name='negative_votes',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='question',
name='positive_votes',
field=models.IntegerField(default=0),
),
]
2 changes: 1 addition & 1 deletion qa/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def get_context_data(self, **kwargs):
context = super(QuestionDetailView, self).get_context_data(**kwargs)
context['last_comments'] = self.object.questioncomment_set.order_by(
'pub_date')[:5]
context['answers'] = answers
context['answers'] = answers.select_related('user')
return context

def get(self, request, **kwargs):
Expand Down

0 comments on commit 878353a

Please sign in to comment.