Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit 6e77b91

Browse files
author
Arjun
committed
2 parents 0e870df + 1ed3053 commit 6e77b91

File tree

8 files changed

+44
-34
lines changed

8 files changed

+44
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A Simple Q&A App using Python Django
22

3-
Live Demo : http://djangoqa.azurewebsites.net/
3+
Live Demo : http://djangoqa.in/
44

55
# Screenshots
66

db.sqlite3

0 Bytes
Binary file not shown.

qa/templates/qa/detail.html

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@
4747
}
4848
</style>
4949

50-
{% if question.reward %}
51-
<div class="rewarding"></div>
52-
{% else %}
5350
{% if question.closed %}
5451
<div class="closed"></div>
5552
{% else %}
56-
<div class="open"></div>
57-
{% endif %}
53+
{% if question.reward %}
54+
<div class="rewarding"></div>
55+
{% else %}
56+
<div class="open"></div>
57+
{% endif %}
5858
{% endif %}
5959

6060
<div class="container">
@@ -94,11 +94,9 @@ <h3><cool>Q: </cool>{{ question.question_text }}</h3>
9494
</div>
9595

9696
{% if answers %}
97-
<div class="panel panel-success">
98-
<div class="panel-heading">
99-
<h3 class="panel-title">Answers</h3>
100-
</div>
101-
<div class="panel-body">
97+
<h3>Answers</h3>
98+
<hr/>
99+
102100
{% for answer in answers %}
103101
<div class="row">
104102
{% if user.is_authenticated %}
@@ -113,16 +111,19 @@ <h3 class="panel-title">Answers</h3>
113111
<a href="/comment/{{ answer.id }}/" class="pull-right"><small><span class="glyphicon glyphicon-comment" aria-hidden="true"></span> Comment &nbsp;</small></a>
114112

115113
{% if answer.votes > 0 %}
116-
<div id="ans" class="alert alert-info" role="alert">{{ answer.answer_text|markdown }}</div>
114+
<div id="ans" class="alert alert-primary" role="alert">{{ answer.answer_text|markdown }}</div>
117115
{% elif answer.votes == 0 %}
118-
<div id="ans" class="alert alert-warning" role="alert">{{ answer.answer_text|markdown }}</div>
116+
<div id="ans" class="alert alert-primary" role="alert">{{ answer.answer_text|markdown }}</div>
119117
{% else %}
120-
<div id="ans" class="alert alert-danger" role="alert">{{ answer.answer_text|markdown }}</div>
118+
<div id="ans" class="alert alert-primary" role="alert">{{ answer.answer_text|markdown }}</div>
121119
{% endif %}
122120

121+
{% if answer.comment_set %}
123122
{% for comment in answer.comment_set.all %}
124-
<p>-<b>{{ comment.comment_text }}</b><small>, <a href="/profile/{{ comment.user_data.user.id }}">{{ comment.user_data.user.username }}</a> at {{ comment.pub_date }}</small></p>
123+
<p><b>{{ comment.comment_text }}</b><small>, <a href="/profile/{{ comment.user_data.user.id }}">{{ comment.user_data.user.username }}</a> <div class="pull-right">{{ comment.pub_date }}</div></small></p>
124+
<hr>
125125
{% endfor %}
126+
{% endif %}
126127
</div>
127128
<div class ="col-md-2">
128129

@@ -135,10 +136,8 @@ <h3 class="panel-title">Answers</h3>
135136
<p class="pull-right">- <b><a href="/profile/{{ answer.user_data.user.id }}">{{ answer.user_data.user.username }}</a> ({{ answer.user_data.points }})</b></p>
136137
</div>
137138
</div>
138-
139+
<hr>
139140
{% endfor %}
140-
</div>
141-
</div>
142141

143142
<div class="pagination">
144143
<span class="step-links">
@@ -161,6 +160,5 @@ <h3 class="panel-title">Answers</h3>
161160
<center><h2>This question is still open, <a href="/answer/{{ question.id }}" role="button">Write answer!</a></h2></center>
162161
{% endif %}
163162

164-
</div>
165163

166164
{% include "qa/footer.html" %}

qa/templates/qa/login.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
padding-top: 120px;
99
padding-bottom: 40px;
1010
background-color: #eee;
11-
11+
1212
}
13-
.btn
13+
.btn
1414
{
1515
outline:0;
1616
border:none;
@@ -104,5 +104,3 @@ <h1 class="form-signin-heading text-muted">Sign In</h1>
104104
<center><h2 class="form-signin-heading text-muted">or</h2>
105105
<a class="btn btn-lg btn-success" href="/register" type="submit">New User? Sign Up</a></center>
106106
</div>
107-
108-

qa/templates/qa/register.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
1+
{% load bootstrap3 %}
22
<div class="container">
33

44
{% include "qa/header.html" %}
55

66
{% if registered %}
7-
<strong>thank you for registering!</strong>
8-
<a href="/">Return to the homepage.</a><br />
7+
<strong>Thank you for registering!</strong>
8+
<a href="/login">You can Login Now!</a><br />
99
{% else %}
10-
<strong>Enter the following details:</strong><br /><br />
10+
<h2>Welcome Aboard!</h2><br /><br />
1111

12-
<form id="user_form" method="post" action="/register/"
12+
<form id="user_form" class="form" method="post" action="/register/"
1313
enctype="multipart/form-data">
1414

1515
{% csrf_token %}
16-
16+
{% bootstrap_form user_form %}
1717
<!-- Display each form. The as_p method wraps each element in a paragraph
1818
(<p>) element. This ensures each element appears on a new line,
1919
making everything look neater. -->
20-
{{ user_form.as_p }}
21-
{{ profile_form.as_p }}
2220

23-
<!-- Provide a button to click to submit the form. -->
24-
<input type="submit" name="submit" value="Register" />
21+
{% buttons %}
22+
<button type="submit" class="btn btn-primary">
23+
{% bootstrap_icon "star" %} Submit
24+
</button>
25+
{% endbuttons %}
2526
</form>
2627
{% endif %}
2728

qa/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import datetime
1010
from qa.forms import UserForm, UserProfileForm
1111

12+
from django.core.mail import send_mail
13+
1214
def search(request):
1315
if request.method == 'POST':
1416
word = request.POST['word']
@@ -136,6 +138,9 @@ def add(request):
136138
t.slug = tag
137139
t.save()
138140
q.tags.add(t)
141+
142+
#send_mail('QA: Your Question has been Posted.', 'Thank you for posting the question, '+question_text+'. We will notify you once someone posts an answer.', '[email protected]', [request.user.email], fail_silently=False)
143+
139144
return HttpResponseRedirect('/')
140145
return HttpResponse(template.render(context))
141146

@@ -164,7 +169,7 @@ def comment(request, answer_id):
164169
c.pub_date = pub_date
165170
c.user_data = user
166171
c.save()
167-
172+
168173
try:
169174
question = Question.objects.get(pk=q_id)
170175
question.views += 1

simpleqa/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@
9797
STATIC_URL = '/static/'
9898

9999
MARKDOWN_EDITOR_SKIN = 'simple'
100+
101+
#EMAIL_HOST = 'smtp.sendgrid.net'
102+
#EMAIL_HOST_USER = 'username'
103+
#EMAIL_HOST_PASSWORD = 'your-password'
104+
EMAIL_PORT = 587
105+
EMAIL_USE_TLS = True

simpleqa/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,6 @@ class QuestionViewSet(viewsets.ModelViewSet):
6262
url(r'^', include(router.urls)),
6363
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
6464

65+
#url('^forgot/', include('password_reset.urls')),
66+
6567
)

0 commit comments

Comments
 (0)