我在管理面板中删除帖子,把新帖子的pk等于2,而不是1.为什么?我做错了什么?
我的模特的例子。
class Post(models.Model):
author = models.ForeignKey('auth.User')
category = models.ForeignKey(Categories)
title = models.CharField(max_length=200,verbose_name='Заголовок')
text = models.TextField(verbose_name='Текст')
created_date = models.DateTimeField(verbose_name='Время создания',default=timezone.now)
published_date = models.DateTimeField(verbose_name='Время публикации',blank=True, null=True)
def publish(self):
self.published_date = timezone.now()
self.save()
def approved_commentimages(self):
return self.comments.filter(approved_comment=True)
def __str__(self):
return self.title