update
This commit is contained in:
parent
c7beb43311
commit
be0ecb665e
|
@ -100,7 +100,7 @@ class Page(models.Model):
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.slug:
|
if not self.slug:
|
||||||
self.slug = slugify(self.title)
|
self.slug = slugify(self.title)
|
||||||
count = Page.objects.all(slug__startswith=self.slug).count()
|
count = Page.objects.filter(slug__startswith=self.slug).count()
|
||||||
if count:
|
if count:
|
||||||
self.slug += '-' + count
|
self.slug += '-' + count
|
||||||
if self.is_published and self.pub_date is None:
|
if self.is_published and self.pub_date is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user