django-social-share
django-social-share copied to clipboard
ready urls context ?
trafficstars
is there a ready urls context like {{ facebook_url }} instead of {% post_to_facebook object_or_url %} i only need a the share link
Hi!
You can use {% post_to_facebook_url <object_or_url> %}, and it will populate a variable called {{ facebook_url }} in your context.
Seems to be dumping all of the template's context for some reason right into the template, as opposed to setting the variable. This appears on my site when I run the code at the bottom:
...<TextNode: '\n\n\n\n'>]>}, {'forloop': {'parentloop': {}, 'counter0': 0, 'counter': 1, 'revcounter': 4, 'revcounter0': 3, 'first': True, 'last': False}, 'post': <Post: test post #2>}, {'post': <Post: test post #2>, 'facebook_url': 'https://www.facebook.com/sharer/sharer.php?u=http%3A//localhost%3A8181/listings/test-post-2/'}]
When I have at the top of my template:
{% load social_share %}
{% post_to_facebook_url post %}
<div class="card border p-2 my-3">
<div class="row g-0">
Keep in mind this is inside a for loop, outputting the posts.
Any ideas?
Made a workaround:
{% post_to_facebook_url post as facebook_url_list %}
{{facebook_url_list.facebook_url}}