Answer the question
In order to leave comments, you need to log in
Can't apply OuterRef(). How to get id as int for __contains check? Or how else?
Есть модели
class Queryes(models.Model):
name = models.CharField(max_length=255, verbose_name='', unique=True)
....
class QueriesHistory(models.Model):
....
datecount = models.DateField(),
queryid = models.ForeignKey('Queryes', on_delete=models.CASCADE)
listpubid = ArrayField(models.IntegerField()) # тут id модели Msg
хочу сделать
Msg.filter(....).annotate(name_field=
Subquery(QueryesHistory.objects.filter(queryid__in=tema_list,
datecount__range=(min(range_date), max(range_date)),
listpubid__contains=[outerRef('id')])[0].queryid.name))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question