Skip to main content

Simple integration of the AddThis social sharing widget for Django projects.

Project description

django-addthis

A simple integration of the AddThis social sharing widget for Django projects.

Authored by Raymond Wanyoike, and some great contributors.

https://img.shields.io/pypi/v/django-addthis.svg https://img.shields.io/pypi/dm/django-addthis.svg https://img.shields.io/github/license/bashu/django-addthis.svg https://img.shields.io/travis/bashu/django-addthis.svg

Installation

First install the module, preferably in a virtual environment. It can be installed from PyPI:

pip install django-addthis

Setup

You’ll need to add addthis to INSTALLED_APPS in your project’s settings.py file:

INSTALLED_APPS += [
    'addthis',
]

Configuration

The addthis_widget template tag requires a site profile id: pub_id. Either pass it as pub_id, or set PUB_ID in your ADDTHIS_SETTINGS settings dictionary:

ADDTHIS_SETTINGS = {
    'PUB_ID': 'xx-xxxxxxxxxxxxxxxx',
    ...
}

The site profile id can be found by visiting its Profile Options page on AddThis (ID:).

There are a few configuration options for addthis that can be placed in your ADDTHIS_SETTINGS settings dictionary:

Option

Default

USERNAME

SERVICES_EXCLUDE

SERVICES_COMPACT

SERVICES_EXPANDED

SERVICES_CUSTOM

UI_CLICK

False

UI_DELAY

0

UI_HOVER_DIRECTION

0

UI_LANGUAGE

UI_OFFSET_TOP

0

UI_OFFSET_LEFT

0

UI_HEADER_COLOR

UI_HEADER_BACKGROUND

UI_COBRAND

UI_USE_CSS

True

UI_USE_ADDRESSBOOK

False

UI_508_COMPLIANT

False

DATA_TRACK_CLICKBACK

True

DATA_GA_TRACKER

Please see the example application. This application is used to manually test the functionalities of this package. This also serves as a good example.

You need Django 1.8 or above to run that. It might run on older versions but that is not tested.

Usage

  1. First of all, load the addthis in every template where you want to use it:

    {% load addthis %}

    then load the widget:

    {% addthis_widget %}
  2. Visit the AddThis Get the Code page and create/generate your social sharing code, e.g:

    <!-- Go to www.addthis.com/dashboard to customize your tools -->
    <div class="addthis_sharing_toolbox"></div>

    Be sure to omit the:

    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xx-xxxxxxxxxxxxxxxx"></script>

    part of the (generated) code as the addthis_widget template tag takes care of this.

Example

{% load addthis %}

<!DOCTYPE html>

<html>
<head>
  <meta charset="utf-8">
  <title>django-addthis Example</title>
</head>

<body>
  <!-- Go to www.addthis.com/dashboard to customize your tools -->
  <div class="addthis_sharing_toolbox"></div>

  <p>Well, the way they make shows is, they make one show. That show's
  called a pilot. Then they show that show to the people who make shows,
  and on the strength of that one show they decide if they're going to
  make more shows. Some pilots get picked and become television programs.
  Some don't, become nothing. She starred in one of the ones that became
  nothing.</p>

  <!-- Placed at the end of the document so the page load faster -->
  {% addthis_widget %}
</body>
</html

Contributing

If you’ve found a bug, implemented a feature or customized the template and think it is useful then please consider contributing. Patches, pull requests or just suggestions are welcome!

License

django-addthis is released under the GNU GPL v3 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-addthis-3.0.2.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

django_addthis-3.0.2-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file django-addthis-3.0.2.tar.gz.

File metadata

  • Download URL: django-addthis-3.0.2.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for django-addthis-3.0.2.tar.gz
Algorithm Hash digest
SHA256 3d6a404ba4debf138a8dd225d3cc5ef4106d2cb9a1fcf9c0ddaaaffaed36ba35
MD5 c98852282f1d0e2fc234263002fd57ba
BLAKE2b-256 bd3dbd96807b58702218c9189588106a917525d9cda28395c058606efdde594a

See more details on using hashes here.

File details

Details for the file django_addthis-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_addthis-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for django_addthis-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf631fe7403d486d571ef2c510e3199e8f1920f2a687e04a4954a0935532c84
MD5 e65751f7e276a55b856818dacf89c064
BLAKE2b-256 06f09852d09ff70504be7bdc6b787baec95ad91e597f2d983df343ea75868af3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page