Allow other primary key column name

Dear,

I was trying to use your software, but my table has a primary key column with a different name ('uniqueid'), then database triggers will fail.
I made some changes to your code in order to be agnostic to the name of primary key column.
I have tested changes with Django 1.4.10 and PostgreSQL 9.2
Please take a look to my changes and give me some feedback. 

Cheers from Argentina.