Link
Django ORM object id’s not available in post_save

I recently had much fun migrating a large Django project from Django 1.0 to 1.3.  During the migration a pretty tricky bug popped up.  I had a listener attached to the post_save signal for the User object, which created some additional objects upon registration.  The problem was, after the upgrade to Django 1.3, the object instance’s id was set to None when passed to the post_save handler.   

After diving down the Django db stack I concluded that a newly introduced method of retrieving the last inserted id from my Postgresql database was failing. The SQL used is: 

SELECT CURRVAL(pg_get_serial_sequence(‘auth_user’,’id’))

but for some reason pg_get_serial_sequence was returning NULL - so the id could not be retrieved.

Googling hinted that this was because the sequence didn’t have the correct table ownership. Indeed, performing this query on the database:

ALTER SEQUENCE auth_user_id_seq OWNED BY auth_user.id;

solved the issue!

My database is very old; the production database was probably created by Django 0.96 or earlier.  The correct sequence ownership where either never set up correctly or lost somewhere along the way.  

06:47 pm: kalleh

Link
Building grib_api 1.9.8 on Snow Leopard

GRIB_API 1.9.8 seems to be a bit confused about architectures when building on Snow Leopard. The fix however is simple, pass -m64 to gfortran:

FCFLAGS=”-m64” ./configure

05:26 pm: kalleh

picture HD
Who needs graphics? (Sailonline chart engine testing)

Who needs graphics? (Sailonline chart engine testing)

06:43 pm: kalleh

picture HD
Winter girl

Winter girl

09:04 pm: kalleh

picture HD
Wedding preparations

Wedding preparations

12:53 am: kalleh

picture HD
The Sounds @ debaser

The Sounds @ debaser

11:44 pm: kalleh

picture HD
Saturday party. Love you guys.

Saturday party. Love you guys.

11:19 pm: kalleh

picture HD
Lovers in the night

Lovers in the night

12:53 am: kalleh

picture HD
Party people

Party people

11:20 pm: kalleh

picture HD
Chevrolet

Chevrolet

12:39 pm: kalleh