I have the following model:
class Process(models.Model):
title = models.Charfield(max_length=255)
date_up = models.DateTimeField(auto_now_add=True)
day
You are mixing two layers: run-time layer and the database layer. F
function is just a helper which allows you to build slightly more complex queries with django ORM. You are using timedelta
and F
together and expecting that django ORM will be smart enough to convert these things to raw SQL, but it can't, as I see. Maybe I am wrong and do not know something about django ORM.
Anyway, you can rewrite you ORM call with extra extra and build the WHERE clause manually using native SQL functions which equals to datetime.now()
and timedelta
.