article_details.html
<form action="{% url 'like_post' post.pk %}" method="POST">
<form action="{% url 'dislike_post' post.pk %}" method="POST">
{% csrf_token %}
{% if user.is_authenticated %}
{% if liked %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Unlike</button>
{{ total_dislikes }} Dislikes
{{ total_likes }} Likes
{% elif disliked %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Undislike</button>
{{ total_dislikes }} Dislikes
{{ total_likes }} Likes
{% else %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Like</button>
{{ total_likes }} Likes
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Dislike</button>
{{ total_dislikes }} Dislikes
{% endif %}
{% else %}
<small>Login to like te post</small>
{% endif %}
0
7
<form action="{% url 'like_post' post.pk %}" method="POST">
<form action="{% url 'dislike_post' post.pk %}" method="POST">
{% csrf_token %}
{% if user.is_authenticated %}
{% if liked %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Unlike</button>
{{ total_dislikes }} Dislikes
{{ total_likes }} Likes
{% elif disliked %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Undislike</button>
{{ total_dislikes }} Dislikes
{{ total_likes }} Likes
{% else %}
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-primary btn-sm">Like</button>
{{ total_likes }} Likes
<button type='submit', name='post_id', value="{{ post.id }}", class="btn btn-danger btn-sm">Dislike</button>
{{ total_dislikes }} Dislikes
{% endif %}
{% else %}
<small>Login to like te post</small>
{% endif %}
Thank you!
7
0
Are there any code examples left?
New code examples in category Html