Re: unique=True doesn't seem to do its job

2008-04-02 Thread Julien
Oh! I'm using MYSQL and I just realised that there was an option to set the field unique in there. I hadn't put "unique=True" when I first ran syncdb... so it was not taken into account after I later added it in the model definition. Thanks! On Apr 2, 5:42 pm, Kenneth Gonsalves <[EMAIL PROTECTED

Re: unique=True doesn't seem to do its job

2008-04-01 Thread Kenneth Gonsalves
On 02-Apr-08, at 12:03 PM, Julien wrote: > get() returned more than one Project -- it returned 2! Lookup > parameters were {'slug__exact': u'hello'} > > I have the same issue on the front end using ModelForm. > > Shouldn't that raise an IntegrityError, and then reload the form page > with an err

Re: unique=True doesn't seem to do its job

2008-04-01 Thread Julien
Sorry, above I meant "I would NOT get an IntegrityError but the following:..." On Apr 2, 5:33 pm, Julien <[EMAIL PROTECTED]> wrote: > Hi there, > > I have a slug field which I'd like to be unique, so I do like this: > > class Project(models.Model): > slug = models.SlugField(_('bla'), max_leng

unique=True doesn't seem to do its job

2008-04-01 Thread Julien
Hi there, I have a slug field which I'd like to be unique, so I do like this: class Project(models.Model): slug = models.SlugField(_('bla'), max_length=50, blank=True, unique=True, help_text=_('blabla')) In admin, if I saved a project with the slug 'hello', and then saved another one with t