Answer the question
In order to leave comments, you need to log in
How to create a timer in a django model?
I have no idea yet how to create a timer in a model for Django.
In general, in my model there is a status field - a field for choosing one of the options. There is a field expired_in , which is an int and implies the number of days. And the field created , logically - datetime on creation.
The task is to change the status after the expiration of time (created + expired_in (in days) < now()).
I thought, through the views, do not give access to the request if the condition is not met, but then how to change the status?
Will the status change work when requested? Well, type, take one part and continue to use it, and the other part (expired), change the status and make a save. But then in the database, if there are no requests, nothing will be updated, is this an adequate solution?
And is there anything more elegant? Kind of like a constantly called function.
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