Templatetags for 'tweet this' and 'share on facebook'
Project description
Provides tempatetags for ‘Tweet This’ and ‘Share this on Facebook’.
Installation
$ pip install django-social-share
Add the app to INSTALLED_APPS:
INSTALLED_APPS += ['django_social_share']
It’s recommended to add django.core.context_processors.request to your `` TEMPLATE_CONTEXT_PROCESSORS`` list. This way the templatetags will use the correct scheme and hostname.
If django.core.context_processors.request is not present, it will simply concatenate the current site’s domain (from django.contrib.sites) and the object’s relative URL together.
Usage
{% post_to_facebook <object_or_url> <link_text> %} {% post_to_twitter <text_to_post> <object_or_url> <link_text> %}
<text_to_post> may contain any valid Django Template code. Note that Facebook does not support this anymore.
<object_or_url> is optional. If you pass a django model instance, it will use its get_absolute_url method. Additionally, if you have django_bitly installed, it will use its shortUrl on Twitter.
<link_text> is also optional. It defines the text used for the a element. Defaults to ‘Post to Facebook’ and ‘Post to Twitter’
Example:
{% load social_share %} {% post_to_facebook object_or_url "Post to Facebook!" %} {% post_to_twitter "New Song: {{object.title}}. Check it out!" object_or_url "Post to Twitter" %}
Templates are in django_social_share/templatetags/post_to_twitter.html and django_social_share/templatetags/post_to_facebook.html. You can override them to suit your mileage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-social-share-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7101af65934eb761dc7100bdf45b683f5308b0bfd64b91d2e9d18e16f0f7f624 |
|
MD5 | bc8b627352b5edb4222699a847d3a634 |
|
BLAKE2b-256 | 82e8b46ee70f401e119ba4ad7df09ca1216f4e86ed252e4c62d68db4cfdefba5 |