The task I want to accomplish is simple: track the number of times a post on my blog has been shared because I want the number to be displayed beside the post. However, I cannot figure it out.
Here is the the anchors with hrefs that allow the user to click on them and share the post on social media:
<ul class="mb-30 list-a-bg-grey list-a-hw-radial-35 list-a-hvr-primary list-li-ml-5">
<li class="mr-10 ml-0">Share</li>
<li><a href="https://www.facebook.com/sharer/sharer.php?u={{ request.build_absolute_uri }}"><i class="ion-social-facebook"></i></a></li>
<li><a href="http://twitter.com/share?url={{ request.build_absolute_uri }}"><i class="ion-social-twitter"></i></a></li>
</ul>
I have a Post model with a variable called share_count. Obviously, I have a view that helps renders out the HTML too. My issue is that I do not understand how to connect the hrefs to my view in order to increment the share_count of the post in the database.
I searched all over and could not find an answer, I would appreciate any help or hints.
Also, can you explain it as if you are telling someone who just started web development...oh wait, that is exactly what is going on!