views:

23

answers:

1

I am using Postgres as DBMS and Django.

My model that defines the table is:

class TtnetModem(models.Model):

ttnetModemSerino=models.CharField(_(u"Seri No"), max_length=20, default='', null=True, blank=True)

I change field definition...

ttnetModemSerino=models.CharField(_(u"Seri No"), max_length=20, unique= True)

on postgres, i execute :

ALTER TABLE bayiislemleri_ttnetmodem ADD CONSTRAINT ttnetModemSerino_key UNIQUE(ttnetModemSerino);

bayiislemleri is my application name and ttnetmodem is my model name... But i get floolwing error:

ERROR: column "ttnetmodemserino" named in key does not exist

What am i doing wrong?

+1  A: 

ttnetmodemserino is in lower case, it looks like ttnetModemSerino has some upper case characters. Make sure your piece of SQL uses double quotes for the objects:

ALTER TABLE bayiislemleri_ttnetmodem ADD CONSTRAINT ttnetModemSerino_key UNIQUE("ttnetModemSerino");

I have no idea how to do it in Django, can't help you there.

Frank Heikens