primary key auto increment with PostgreSQL and non Django standard column name

2011-05-27 Thread Naoko Reeves
Hi, I have a Django newbie question. My goal is to auto increment primary key with non Django standard column name. We are converting from existing database and primary key schema is "tablename_key" and not "id". I googled it and end up reaching to this ticket: https://code.djangoproject.com/ticket

Re: primary key auto increment with PostgreSQL and non Django standard column name

2011-05-27 Thread Naoko Reeves
erField): > > https://docs.djangoproject.com/en/1.3/ref/models/fields/#autofield > > Hope this helps! > Casey > > On 05/27/2011 07:22 PM, Naoko Reeves wrote: >> Hi, I have a Django newbie question. >> My goal is to auto increment primary key with non Django standard

Re: primary key auto increment with PostgreSQL and non Django standard column name

2011-05-27 Thread Naoko Reeves
te: > Doesn't autofield with primary_key=True handle this for you (instead of > making it an IntegerField): > > https://docs.djangoproject.com/en/1.3/ref/models/fields/#autofield > > Hope this helps! > Casey > > On 05/27/2011 07:22 PM, Naoko Reeves wrote: >> Hi, I h

Re: primary key auto increment with PostgreSQL and non Django standard column name

2011-05-28 Thread Naoko Reeves
; print p5.pk None On 5/28/11 12:23 AM, "Malcolm Box" wrote: > You need to tell django what the db column name for your pollkey field is. > Look at the dbname field option in the docs. > > > Sent from my iPhone, please excuse any typos > > On 28 May 2011, at 05:13

[SOLVED] primary key auto increment with PostgreSQL and non Django standard column name

2011-05-29 Thread Naoko Reeves
I was missing this from schema: ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname; Now everything is happy. Thank you! On 5/28/11 8:32 AM, "Naoko Reeves" wrote: > Malcolm, Thank you for your advice! > I changed my model as follows: > poll_key = models.Au

Call SQL function within Model

2011-06-27 Thread Naoko Reeves
Dear Experts, I am using postgresql and have field type bytea. This is an encrypted field I normally decrypt value with sql function. I would like to use this function to return value from Django model. Is this possible? If so could you guide me how could I accomplish this? Thank you very much for