My very own mini-sprint

by Marty Alchin on September 7, 2007 about Django

Perhaps in anticipation of next week’s sprint, or maybe due to just plain luck of the draw, I made major progress on three separate projects today. I feel tired, but exhilarated at the same time. If this is what a sprint feels like, I want to take part. Badly.

First, my dbsettings project just gained a comprehensive test suite, which means it’s finally in a complete condition. Unless somebody has major features or bugs, it’s done.

Second, I finally published my first crack at a patch for pluggable FileField backends. There’s no documentation yet, but if you’re interested in looking at some code, feel free. I also have backends in the works for S3, MogileFS, WebDAV and even SVN!

Lastly, in the completely-out-of-nowhere department, I’d like to announce the first release of django-modular, a framework for creating content modules for a site, similar to the customizable homepages at Google or Yahoo. Creating modules a very simple process, simply declaring a single class and a template. All the rest is handled by the framework. The only think not implemented so far is rearranging modules. I don’t have documentation written yet, but the following sample should give you a very basic idea of how simple the declaration is:

import modular

class HelloModule(modular.Module):
    title = 'Example module'
    template = 'myapp/hello_module.html'

    name = modular.CharField(max_length=100)

Then, just define a simple template to actually display the module:

{% extends 'modular/module.html' %}

{% block content %}Hello, {{ module.name }}!{% endblock %}

That’s a bit oversimplified, but that’s the basic idea. Users can customize any of the fields provided on the module, and the user’s values are made available to the template. I’ll explain in more detail later, when I get proper documtation written up.