I want to display data of today
, yesterday
and last 7 days
, please let me know how I can do it.
I am trying this....but it's displaying me only the last 7 days data, but I want to display data in my HTML file according to today
, yesterday
and last 7 days
here is my views.py
file..
def myview(request):
datas= Mymodel.objects.filter(created_on_gte=datetime.now()-
timedelta(days=7)).count()
context= {'datas':datas}
return render(request, 'test.html', context}
here is my test.html
file, where I am displaying data...
<p>{{datas}} today</p>
<p>{{datas}} Yesterday</p>
<p>{{datas}} Last 7 Days</p>