January 2009
1 post
2 tags
Testing time-based views in Django
There are situations where real time is important in the behaviour of some views. For example, one could write an anti-spam mechanism to prevent robots or ill-intended users to post a form too often and too rapidly. In this article I’ll present a strategy for testing such views. Let’s take a very simple example, in which we’ll let users post messages. The time constraint...
Jan 25th
2 notes
November 2008
1 post
2 tags
Misconceptions about testing (and what we should...
This post is a reply to Eric Holscher’s call for suggestions to extend and improve the documentation about testing in Django. By no means am I an expert in testing, but I thought I would share some thoughts I’ve had about this. It is more like a dump of ideas that come from my own experience, and hopefully that will contribute slightly to the debate. The existing documentation is...
Nov 14th
1 note
October 2008
1 post
4 tags
Site-wide login protection (and public views)
A common pattern in websites is when a few pages are protected and require a login to be accessed. The @login_required decorator often comes in handy for these situations. But, another pattern which is quite common is when most of the site is protected, with just a few exceptions of pages that remain public (e.g. frontpage, registration page, etc.). In that case, it can be quite tedious to...
Oct 22nd
41 notes
August 2008
3 posts
2 tags
Adding search to a Django site in a snap
Search is a feature that is — or at least, should be — present on most sites containing dynamic or large content. There are a few projects around to tackle that. Here’s a non-exhaustive list: djangosearch, django-search (with a dash), django-sphinx. Those search engines are great, but they seem like overkill if you just need a simple search feature for your CMS or blog. To...
Aug 15th
1 tag
How to do a case study
A few months ago I’ve conducted my first case study. For 2.5 months I’ve followed a film score project between a Melbourne-based filmmaker and a Sydney-based composer. It has been a fantastic experience, and although I improvised quite a bit, the results have been extremely rich and valuable. Now I’m confronted to writing the report for that case study. That is not an easy...
Aug 11th
1 note
3 tags
Proxying Django's admin views
In this post I share some thoughts on one way to customise the Django’s admin interface beyond what, I believe, it was originally designed for. Well, at least it’s an approach that I used to bring django-treemenus’ codebase up to the NewForms-Admin’s API, while preserving the app’s original behaviour. First, you may want to check the latest release of...
Aug 7th
July 2008
2 posts
3 tags
A simple site-wide, per-user, date format...
It is important to be aware that dates are spelled differently in different countries (e.g. dd/mm/yyyy in Australia or mm/dd/yyyy in the US). This is why it is a good idea to let the user select their preferred date format and store it into their user profile. For example, you may store the values "%d/%m/%Y" or "%m/%d/%Y" in that user’s profile. That way, you may display dates in the format...
Jul 29th
8 notes
2 tags
Django-treemenus new release 0.5
I have just packaged a new release 0.5 for django-treemenus That release should only concern people working on Django’s development version after the merge of the newforms-admin branch. I also hear that Django 1.0 alpha has just been released, so that’s good timing ;) If you’re using Django’s trunk prior the NFA merge, then you can stick to 0.4. I’ve also...
Jul 21st
May 2008
2 posts
2 tags
Django-treemenus new release 0.4
I have just released the version 0.4 of django-treemenus It does not contain code modifications so you don’t necessarily have to upgrade if you’re currently using it. In fact, this release integrates more languages, so you may be interested if you’re not happy with the standard English version. Thank you to Maxim Oransky for marking a couple of missing strings and for...
May 25th
2 notes
1 tag
At last, my blog is up
UPDATE: This blog has since been moved to Tumblr I finally managed to take a bit of time to set up this blog. It was implemented in Django and based on the excellent Coltrane (along with template-utils and comment-utils) by James Bennett. For more technical details, the typography is enhanced with typogrify, tagging is done with django-tagging, and the code highlighting is managed by pygments....
May 24th