Click here to Skip to main content
15,666,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello everyone! So, basically how can you make all the model instances updated on a daily basis in Django? Right now, I have a model that has each of my students' information. I want to update each of my students information everyday, so that the correct students will show up in my schedule list in django daily. For example, if it is a holiday, then a "show in my list" field in each student's model will be updated to false. Of course, I am going to add a lot of functions such as "is it a holiday today?", "does the student have a class with me today?", "at what time does the student have class with me today?", etc. If the student matches all of the requirements(or functions) to "show up" in my schedule, then the "show in my list" field in each student's model will be updated to true. My schedule list will then loop through all of my students to just display students with the "show in my list" field = True. So, I need a function(or a list of functions) to update each of my model instance daily. Any ideas or recommendations on how I can do this? Since I am a beginner, I would also appreciate an "easy way" to do this task. Thanks everyone!

What I have tried:

I researched about scheduled tasks, but I don't really understand it. I am a windows user, so I think I need to use celery, but I don't know if celery can do all the tasks I need to do.
Updated 7-Apr-21 22:31pm
Richard MacCutchan 8-Apr-21 4:33am    
The only time this information is needed is when you run the application. So just add a startup function that checks the current date against the date that things were last updated. It can then do whatever updates are pending.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900