I am making a project in Django right now that needs to select a daily item from the database (it's like a Wordle type of project). I have a database of 100 items and I want every user who visits the site to see the same daily item. I tried to do some logic of converting a date to an integer to index the database, but it got clunky and I figured there must be a better way to do this. The goal is to select from the database based on datetime.now and have it return one unique row. After the database has been used up it will just reset and start over again. I also considered having a daily job run every day to update the database with a 'todaysItem' flag but I don't think that is the best solution.
Asked
Active
Viewed 14 times