Category Archives: Django

Django custom user model in admin, relation “auth_user” does not exist

I have a custom user model as below:

And using the builtin UserAdmin

While editing the user record works fine, but when I add a user, I get the following error

After some digging around and found this https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#custom-users-and-the-built-in-auth-forms The culprit is a function clean_uesrname inside UserCreationForm inside django.contrib.auth.forms.py A few tickets… Read More »

New Zealand Weddings New Website Launch

After a month’s effort we’ve finally released the first phase of the new NZ weddings website. Check it out http://newzealandweddings.co.nz The new site is written in django framework, a lot of functionalities such as the editorial section was ‘borrowed’ from the existing infrastructure which powers the Stoppress and the Idealog websites.

Internal SOA data transfer via memcache?

We have been working on a python/django project which is SOA oriented, all sites(systems) are internal and communications are done via http restful api requests. Our setup share the same set of memcache servers to cache data individually on each sub site(system). Often when site A wants data from site B, site A makes a… Read More »

Django snippet: reduce image size during upload

Just a quick python snippet I written today to reduce the image size during upload

Creating custom log handler that logs to database models in django

I was told to create some kind of logging mechanism to insert logs into database, and make sure it’s generic. So after some thought I decided to mimic the builtin RotatingFileHandler and write a DBHandler. The RotatingFileHandler allows you to specify which file to write to and rotate files, therefore my DBHandler should also allow… Read More »