Re: unique=True and IntegrityError

2009-09-01 Thread aa56280
> The check for unique fields is done in the base ModelForm clean method.  By > overriding clean without calling the superclass clean you are causing the > checks to be bypassed. I read up on it while you were posting your reply :)

Re: unique=True and IntegrityError

2009-09-01 Thread Karen Tracey
On Tue, Sep 1, 2009 at 12:51 PM, aa56280 wrote: > > You're right, I did leave out something - the clean() method. Nothing > unusual there. In fact, if I take out everything from the method and > leave the shell: > > def clean(self): > return self.cleaned_data > > It still

Re: unique=True and IntegrityError

2009-09-01 Thread aa56280
You're right, I did leave out something - the clean() method. Nothing unusual there. In fact, if I take out everything from the method and leave the shell: def clean(self): return self.cleaned_data It still craps out. However, if I take away the entire method, then I do get the validation

Re: unique=True and IntegrityError

2009-09-01 Thread Karen Tracey
On Tue, Sep 1, 2009 at 1:20 AM, aa56280 wrote: > > ### Model ### > class School(models.Model): >url = models.SlugField(max_length=50, unique=True) >name = models.CharField(max_length=255) >... > > > ### Form ### > class SchoolForm(ModelForm): > >class Meta: >

Re: unique=True and IntegrityError

2009-08-31 Thread aa56280
On Aug 31, 9:51 pm, Karen Tracey wrote: > However if you use a ModelForm to validate the data prior to attempting to > save the model you get these problems reported as validation errors: Karen, Thanks for the thorough explanation. I really appreciate it. What I took from

Re: unique=True and IntegrityError

2009-08-31 Thread Karen Tracey
On Mon, Aug 31, 2009 at 6:27 PM, aa56280 wrote: > > I can't find an answer to this, so I'm hoping folks here can help: why > is it that Django catches IntegrityError for a field with unique=True > in the Admin tool but requires you to catch it yourself in your app? > That is,

unique=True and IntegrityError

2009-08-31 Thread aa56280
I can't find an answer to this, so I'm hoping folks here can help: why is it that Django catches IntegrityError for a field with unique=True in the Admin tool but requires you to catch it yourself in your app? That is, why isn't it handled like all other built-in validation checks that come