我有两个应用news
和article
,它们都具有完全相同的型号Comment
:
class Comment(models.Model):
author = models.ForeignKey(User)
created = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=100, default='', blank=True)
body = models.TextField()
post = models.ForeignKey(Photo)
published = models.BooleanField(default=True)
现在,在视图中,我想删除这两个应用中的某些评论:
Comment.objects.filter(author=someauthor).delete()
如何在不更改型号名称的情况下实现这一目标?