On Aug 31, 9:51 pm, Karen Tracey <kmtra...@gmail.com> 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 it is that if I'm using a ModelForm, Django should return a validation error for a duplicate value. However, for my scenario, I *am* using a ModelForm. Here's a snippet: ### 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: model = School fields = ('url', 'name') ### View ### def new_school(request): if request.method == 'POST': form = SchoolForm(request.POST) if form.is_valid(): form.save() new_school craps out with an IntegrityError exception any time I have a duplicate value. Any additional thoughts? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---