Affiliations

» See a train - click here

Entries with tag "code"

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:  

November 14, 2008

Tags: code, django, extjs, source

Finally got around to creating a repository for the source code of ExtPaste a ExtJS [1] / Django [2] powered pastebin [3].

People where asking me about the source code for http://extpaste.com on the ExtJS forums for some time now. So here it is: http://hg.trbs.net/extpaste/

The project was development and currently runs on a Django version before 1.0 :( But i'm working at this moment to get the repository up to date with Django 1.0. I've already ported it to NewForms-Admin so the biggest thing left is to port to newforms.

If everything goes fine the code in the repository should be on Django 1.0 before the end of the day.

Updated 15-Nov-2008: Extpaste now runs on Django 1.0 and higher

[1]ExtJS JavaScript Framework: http://www.extjs.com
[2]Django Web Framework: http://www.djangoproject.com
[3]Modeled closely to the excellent dpaste Django pastebin: http://dpaste.com
Add to: