python - Query-based view that changes periodically -


so i'm working on django project restaurant's page , need make view menu changes weekly.

class weeklychangingmenu(models.model):      introduction_date = models.datefield()      options = models.charfield(max_length=500) 

and have menu view:

def menu(request):     menu = weeklychangingmenu.objects.get(introduction_date < datetime.date.today())     return render(request, "menu.html", {"menu":menu}) 

and i'm looking way to, rather making same query on , over, making query once week by, say, manage.py command store , reuse info if hardcoded view week make lot easier database.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -