From c44c90065eeb5beecc17935e1c54765ba414175b Mon Sep 17 00:00:00 2001 From: Arjun Date: Mon, 19 Jan 2015 21:26:52 +0530 Subject: [PATCH] v0.2 Vote Answers --- db.sqlite3 | Bin 184320 -> 184320 bytes qa/migrations/0008_answer_votes.py | 20 ++++++++++ qa/migrations/0008_answer_votes.pyc | Bin 0 -> 842 bytes qa/models.py | 1 + qa/models.pyc | Bin 2538 -> 2602 bytes qa/templates/qa/detail.html | 42 +++++++++++++++++--- qa/templates/qa/index.html | 11 +++++- qa/views.py | 59 ++++++++++++++++++++++++++-- qa/views.pyc | Bin 4974 -> 6230 bytes simpleqa/urls.py | 1 + simpleqa/urls.pyc | Bin 925 -> 1031 bytes 11 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 qa/migrations/0008_answer_votes.py create mode 100644 qa/migrations/0008_answer_votes.pyc diff --git a/db.sqlite3 b/db.sqlite3 index ce3d545f5d67306cf40525e44024adf9fc056133..1aff27612050c81b3de652e46bc58918a30497bb 100644 GIT binary patch delta 1077 zcmah|QEL=e6uxJ6wwr8r?%AYjirDOIwi*K2*?VVZcV^cY7c7L5{s5t9C&?t)m~67y zF>xhe455@Fq68iA#Z~$s)!NjRY^CB;Xx?h9AU+gn`_ev?)CWQEMQ0~VY7p^Z&J1(T z_kHJ_``v|V+d{SN{N4`86GD>B2fX*e3w^2p`5(Xh7WYM@d4lVB35PL-g#JR$(jzo3 z{VlCX^R;;N3rSZaLDHVemn_DZdCV%7=j@qdvr~>;RvAwx8Bg-8%(a}#a-1n#&1N%N zZRO){+9?KNP_mj3y4;@{fW-2})Hp}o@070omDhF&3Ntf{jdHMV89Jkp@+hN z)PWbtZ*YLz3m#sMM;F|CRoD}b{0r-yy}htB>At8!9Qxe}}!g55IVT`mJ}%g`#7R+B5FwKfrDG{&yhPFJA*E{DE|rh+}4b*Y|J-S~qwM z&JY5c`|uX535Bf7u0dgS1%6dzQ!Q0yCrg!#GdO&*=*&%Mv-WIh&MMj`#tOrwk^1IS z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9 --- /dev/null +++ b/qa/migrations/0008_answer_votes.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('qa', '0007_answer_pub_date'), + ] + + operations = [ + migrations.AddField( + model_name='answer', + name='votes', + field=models.IntegerField(default=0), + preserve_default=True, + ), + ] diff --git a/qa/migrations/0008_answer_votes.pyc b/qa/migrations/0008_answer_votes.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bcef7637ba366e3c294095755c44fa7df27aa00c GIT binary patch literal 842 zcmb`F&2H2%5XZ-fll=gs3L%~$r)F<(K!}eDsRuZu<-lGncRjmG($-fQuW({d zVe7-1WqX)(Xb0!Ril!eQrhiE}`i@C2NFXqvS;K)yGr$}=$*jaiNCaX^zyi7w%mU1k z2!&YzE=WlJWC_hx^@ui#%yO&aGkR?{n-@wu{}m@S#v5gHz?qFPmD4>&rk+!RB$;9b ziMt`753KerS`!we4DNNbp(QyRF;3`lxY}SJhF$E@1z(#^yTefXwjV9t>YAQYBWp7B<%6Ngp!4y*;SFS(nr-#m^|S1G{s-QV!~OsO literal 0 HcmV?d00001 diff --git a/qa/models.py b/qa/models.py index d86598b..5357c3a 100644 --- a/qa/models.py +++ b/qa/models.py @@ -34,6 +34,7 @@ def __unicode__(self): class Answer(models.Model): question = models.ForeignKey(Question) answer_text = models.CharField(max_length=200) + votes = models.IntegerField(default=0) pub_date = models.DateTimeField('date published') user_data = models.ForeignKey(UserProfile) def __str__(self): diff --git a/qa/models.pyc b/qa/models.pyc index 633b2fcf5322a02e405fee2e01c95d0e93e1b0f6..d9a3368d77aa5da6912d861717879c3ec57fd308 100644 GIT binary patch delta 178 zcmaDQyh?U|E-yn0D?vJUB delta 103 zcmZ1_@=BPU`7 + + +
-

Q: {{ question.question_text }}

+

{{ question.pub_date }}

+

Q: {{ question.question_text }}

Answer this Question!

-{% if question.answer_set.count %} +{% if answers %}
-

There are {{ question.answer_set.count }} Answers

+

There are {{ answers.count }} Answers

- {% for answer in question.answer_set.all %} - + {% for answer in answers %} +
+ {% if user.is_authenticated %} +

{{ answer.votes }}

+ {% endif %} +
+

- {{ answer.user_data.user.username }} ({{ answer.pub_date }})

+
{% endfor %}
+ + + {% else %}

This question is still open, Write answer!

{% endif %} diff --git a/qa/templates/qa/index.html b/qa/templates/qa/index.html index f4b651b..895c086 100644 --- a/qa/templates/qa/index.html +++ b/qa/templates/qa/index.html @@ -3,6 +3,15 @@ {% bootstrap_css %} {% bootstrap_javascript %} + + + +