Affiliations

» See a train - click here

Entries with tag "network"

July 11, 2009

Tags: app, bookmarks, code, django, hg, network, reusable, social

The Django Social Bookmarks app does what you might expect this application to do.

It provides an easy and reusable way to get those pesky add to this social network site on a Django site.

It currently supports 34 different sites, ranging from the big ones like; twitter, facebook, slashdot, delicious, digg, technorati, strumble to local networks like nujij (Dutch), ekudos and tagmos or netjes (Belgium).

All texts in the app use Django i18n so people should have no trouble contributing both links and translations to make it truly comprehensive.

After adding social_bookmarks to INSTALLED_APPS and making sure the images are reachable you can use the provided inclusion-tag to add the links in a template.

Template example:

{% load social_bookmarks_tags %}
<div class="content">
    {{ content }}
    {% show_social_bookmarks object.title object.get_absolute_url %}
</div>

The default inclusion-tag template specifies some simple css classes so you can theme the links without having to write you own template.

CSS:

/* div around the entire block of links ^/
.socialbookmarks {
    display: block;
}
.socialbookmarks strong {
    font-weight: bold;
    color: black;
}
/* individual links */
.socialbookmarks .social {
    color: #ccc;
}
/* no borders on images */
.socialbookmarks .social a img {
    border: 0px;
}
Code is maintained in a mercurial repository and can be found here:
http://bitbucket.org/trbs/django-social-bookmarks/
Some points on the todo list for the future are:
  • Some more tags and/or api functions, for people that don't want to use the inclusion tag.
  • Putting the links in database so that they can be added, changed, enabled and disabled in the admin.
  • Add caching to the template tags

Hopefully it is useful for other people and project as well. If you want to use this in your own project, contribute with links, translations or idea please drop me a line at bitbucket or #django irc.

Add to: