更新时间:2023-09-16 11:12:22
您的任务需要相当hacky的代码,这些代码很难维护和理解(如果可能的话)。
You task requires rather hacky code which will be very hard to maintain and understand (if it's even possible).
这怎么办?
class EntryManager(models.Manager):
def by_user(self, user):
# do anything you want
# usage
Entry.objects.by_user(user=user)