给定一组ID,
class Article(model.Model):
hotness = FloatField()
content = TextField()
created = DateField()
@property
def calculate_hotness(self):
return (self.created.replace(tzinfo=None)-datetime(1970,1,1)).total_seconds()
# The hotness field is updated by a cronjob hourly.
recommended_ids = [1,2,3,4]
Article.objects.order_by('-hotness').???
我想在recommended_ids
中给出带有ID的文章,得分为1.5倍。