TypeError: '>' not supported between instances of 'F' and 'CombinedExpression'
...annotate(is_actual__gt=Cast(F('created') > Now() - period, BooleanFields())) # эмм...
...annotate(is_actual=Cast(F('created__gt') > Now() - period, BooleanFields())) # хм...
...annotate(is_actual=Cast(Q(created__gt=Now() - period), BooleanFields()) # так тоже не работает
class Item(models.Model):
name = models.CharField(max_length=255)
price = models.DecimalField(max_digits=16, decimal_places=2)
class ConvertedPrice(models.Model):
item = models.ForeignKey(Item, on_delete=models.CASCADE)
currency = models.CharField(max_length=3)
value = models.DecimalField(max_digits=16, decimal_places=2)