1<form action="{% url 'like_post' post.pk %}" method="POST">
2 <form action="{% url 'dislike_post' post.pk %}" method="POST">
3 {% csrf_token %}
4 {% if user.is_authenticated %}
5 {% if liked %}
6
7 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Unlike</button>
8 {{ total_dislikes }} Dislikes
9 {{ total_likes }} Likes
10 {% elif disliked %}
11
12 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Undislike</button>
13 {{ total_dislikes }} Dislikes
14 {{ total_likes }} Likes
15 {% else %}
16 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Like</button>
17 {{ total_likes }} Likes
18 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Dislike</button>
19 {{ total_dislikes }} Dislikes
20
21 {% endif %}
22 {% else %}
23 <small>Login to like te post</small>
24 {% endif %}
25
1<form action="{% url 'like_post' post.pk %}" method="POST">
2 <form action="{% url 'dislike_post' post.pk %}" method="POST">
3 {% csrf_token %}
4 {% if user.is_authenticated %}
5 {% if liked %}
6
7 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Unlike</button>
8 {{ total_dislikes }} Dislikes
9 {{ total_likes }} Likes
10 {% elif disliked %}
11
12 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Undislike</button>
13 {{ total_dislikes }} Dislikes
14 {{ total_likes }} Likes
15 {% else %}
16 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Like</button>
17 {{ total_likes }} Likes
18 <button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Dislike</button>
19 {{ total_dislikes }} Dislikes
20
21 {% endif %}
22 {% else %}
23 <small>Login to like te post</small>
24 {% endif %}
25