我有以下内容:
appleCreated = Apple.objects.filter(fruit=fruit.id).latest().created
bananaCreated = Banana.objects.filter(fruit=fruit.id).latest().created
lemonCreated = Lemon.objects.filter(fruit=fruit.id).latest().created
orangeCreated = Orange.objects.filter(fruit=fruit.id).latest().created
是.created
一个models.DateTimeField()
我需要在四个中找到最新的datetime
(我不需要知道它是哪一个)。我知道我需要使用.sort(...)
,或者sorted(...)
文档太密集了我不明白key=lambda
,item:item[0]
和key=itemgetter(0)
WTF 之类的东西!?!?!