Re: Incrementing the slug by avoiding Integrity error in django models save method

2013-08-13 Thread Tom Evans
On Mon, Aug 12, 2013 at 9:46 AM, shiva krishna wrote: > I have a model with two fields as below > > **models.py** > > class Publisher(models.Model): > name = models.CharField(max_length=200) > slug = models.SlugField(max_length=150, unique=True) > > def save(self, *args

Incrementing the slug by avoiding Integrity error in django models save method

2013-08-12 Thread shiva krishna
I have a model with two fields as below **models.py** class Publisher(models.Model): name = models.CharField(max_length=200) slug = models.SlugField(max_length=150, unique=True) def save(self, *args, **kwargs): if not self.id and not self.slug: