无法获取blog_id。请帮助我解决此问题---models.py
class Blog(models.Model):
title = models.CharField(max_length=500)
body = models.TextField()
last_updated_on = models.DateTimeField(auto_now=True)
created_on = models.DateTimeField(auto_now_add=True)
author_instance = models.ForeignKey(AuthorInstance, on_delete=models.PROTECT)
status_draft = models.BooleanField(default=False, blank=True, null=True)
status_publish = models.BooleanField(default=False, blank=True, null=True)
likes = models.ManyToManyField(UserInstance, related_name='like', default=None, blank=True)
like_count = models.BigIntegerField(default='0')
def total_likes(self):
return self.likes.count()
一月一日
def like_post(request):
post = get_object_or_404(Blog, id=request.POST.get('blog_id'))
如何解决????
1条答案
按热度按时间mnowg1ta1#
观点应该像