diff --git a/qa/migrations/0005_auto_20160519_1057.py b/qa/migrations/0005_auto_20160519_1057.py new file mode 100644 index 0000000..77a9dba --- /dev/null +++ b/qa/migrations/0005_auto_20160519_1057.py @@ -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), + ), + ] diff --git a/qa/views.py b/qa/views.py index 8675978..ba8bc5d 100644 --- a/qa/views.py +++ b/qa/views.py @@ -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):