On Sep 4, 7:18 am, canburak <[EMAIL PROTECTED]> wrote: > I have a problem on overriding the save() method. > my new save is: > class ClassName: > def save(self): > self.title = self.title.title() > super(ClassName, self).save() > > when admin site uses this save(), I get the non-unique exception at > django/python level but I hope to see a red box in the admin. How can > I do that? You will need to add a custom validator to the title field of your Model to check for uniqueness of its titlecased version. The admin will check for uniqueness of self.title but it doesn't know that you are titlecasing it later in your Model.save. So, it won't know that the title "canburak" is not allowed even if you already have a record with the title "Canburak" (before the Admin hits the save method, those two strings look different to it.) Another option is to add a slug field to your model, prepopulate it from title, and make it unique (that will give you case-insensitive uniqueness which you may or may not want.) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---