Jacob Kaplan-Moss

Django projects

I wrote this post in 2007, more than 16 years ago. It may be very out of date, partially or totally incorrect. I may even no longer agree with this, or might approach things differently if I wrote this post today. I rarely edit posts after writing them, but if I have there'll be a note at the bottom about what I changed and why. If something in this post is actively harmful or dangerous please get in touch and I'll fix it.

I’ve always thought that the sign of a healthy Open Source project is a vibrant ecosystem around that project. That’s why I’ve been thrilled to see that there are a bunch of cool third-party Django add-ons popping up. I thought I’d take a few minutes and give a shout out to some of my favorites.

django-openid

OpenID evangelist and Alpha Geek Extraordinare Simon Willison wrote this set of tools which lets your Django application become an OpenID consumer.

Once you’ve wired the app up in your settings file, you’ll have access to a user’s OpenID information from your views:

def example_view(request):
    if request.openid:
        return HttpResponse("OpenID is %s" % escape(str(request.openid)))
    else:
        return HttpResponse("No OpenID")

You can read more in the documentation, see in in action on Simon’s site, and provide feedback on the mailing list.

django-registration

Written my friend and co-worker James, django-registration is a simple generic user-registration app that compliments the built-in Django auth system. It couldn’t be simpler; you just include the registration URLs and point your users to /accounts/register/. It Just Works™.

For more information you can check out the ReadMe.

django-tagging

In just a few lines of code you can add tagging to any model you like and easily pull out objects by tag usage, tag clouds for particular objects, etc. A bit of a self-link – I contributed a smidge of code – but it’s really an awesome app.

You might start a del.icio.us clone with something like:

from django.db import models
from tagging.fields import TagField

class Bookmark(models.Model):
    title = models.CharField(maxlength=200)
    url = models.URLField()
    tags = TagField()

… which would let you deal with tags in a very easy manner:

>>> b = Bookmark.objects.get(...)
>>> b.tags = "foo bar baz"

The main developer, Jonathan Buchanan, has written fantastic documentation, and the code is totally solid.

django-voting

Another app by Jonathan. He took the one-off voting code I wrote for CheeseRater as part of my PyCon tutorial and fleshed it out into a great tool. Here’s an example from the documentation:

>>> user = User.objects.get(pk=1)
>>> widget = Widget.objects.get(pk=1)
>>> Vote.objects.record_vote(user, widget, +1)
>>> Vote.objects.get_score(widget)
{'score': 1, 'num_votes': 1}

Jeff added it to Lost-Theories earlier this week (see it in action) and tells me it couldn’t be easier.

A good way to get started might be to read about how you’d go about implementing reddit style voting for any model.

Any more?

Are there cool third-party Django tools you’ve been using lately? Leave some links in the comments; I’d love to check ’em out!