说我有一个类,其中包含一些方法,例如:
# I'm assuming here a couple of things:
# The fields content and date_created exist in your Letter model,
# if there is no date created field, use instead whatever you are using for
# establish some sort of order creation.
MailBox.objects.annotate(
last_letter_content = Subquery(
Letter.objects.filter(mailbox=OuterRef('pk')).order_by('-date_created').values('content')[:1]
)
)
调用removeClickListener不会删除事件侦听器。是因为自我每次都在改变吗?有没有办法在类构造函数中分配self,然后在侦听器参数的匿名函数中引用它?