Answer the question
In order to leave comments, you need to log in
How to implement a post timer in Django?
Good afternoon.
Maybe someone has done something similar in their practice.
I want to add a DateTime field to the model, in which to specify the date and time when the record in the model will be published.
Those. for example, he added several entries in the admin panel, indicated this field, and these entries will be displayed on the site after a given time.
One option I see is to customize the model manager and compare the current datetime with the specified one.
But something tells me that this is a crooked solution.
Please advise the right way.
Answer the question
In order to leave comments, you need to log in
One option I see is to customize the model manager and compare the current datetime with the specified one.normal solution.
class MyModel(Model):
# .....
objects = Manager()
ready_for_pub = CustomManager()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question