-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.html
95 lines (84 loc) · 3.33 KB
/
feed.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li>{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<div align="right">
<form method="post" action="/logout/">
{% csrf_token %}
<input type="submit" class="btn-default btn" value="LogOut">
</form>
</div>
<form method="post" action="/post/">
{% csrf_token %}
<input type="submit" class="btn-default btn" value="Create Post">
</form>
{% for post in posts %}
<h3> Posted by: {{ post.user.username }} </h3>
<p>[{{ post.created_on }}]</p>
<img style="display:inline-block; width:350px; height:300px;"
src="{{ post.image_url }}" /><br>
<span style="display:inline-block;"><b>Category :</b>{{ post.category }}</span><br/><br/>
<span style="display:inline-block;">{{ post.caption }}</span><br/><br/>
<div style="display:inline-block">
{% if post.like_count < 2 %}
{{ post.like_count }} person likes this
{% else %}
{{ post.like_count }} people like this
{% endif %}
</div>
<div style="display:inline-block">
<form method="POST" action="/like/">
{% csrf_token %}
<input type="hidden" name="post" value="{{ post.id }}" />
{% if post.has_liked %}
<input type="submit" class="btn btn-default" value="Unlike">
{% else %}
<input type="submit" class="btn btn-default" value="Like">
{% endif %}
</form>
</div>
<div>
<form method="POST" action="/comment/">
{% csrf_token %}
<input type="hidden" name="post" value="{{ post.id }}" />
<input type="text" name="comment_text" id="comment_text" placeholder="Make a comment.." value="{{ comment_text }}">
{{ comment_text }}
<input type="submit" class="btn-default btn" value="Comment">
</form>
</div>
<p>
{% for comment in post.comments %}
<p><b>{{ comment.user.username }}
[{{ comment.created_on }}]:</b> {{ comment.comment_text }}
</p>
<div style="display:inline-block">
<form method="POST" action="/upvote/">
{% csrf_token %}
<input type="hidden" name="comment" value="{{ comment.id }}" />
{% if not comment.has_upvoted %}
<input type="submit" class="btn btn-default" value="Upvote">
{% else %}
<input type="submit" class="btn btn-default" value="Downvote">
{% endif %}
</form>
{% if comment.upvote_count < 2 %}
{{ comment.upvote_count }} person upvoted this
{% else %}
{{ comment.upvote_count }} people upvoted this
{% endif %}
</div>
{% endfor %}
{% endfor %}
</body>
</html>