Dear Team,
Email: eugene.tuyizere@aims-cameroon.org
eugenetuyizere@gmail.com
Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
-- I need help. I am working on a project where one of the tables is about requests. I want to have a report of the number of requests on each day in the last 30 days, something like this:
def reqChart(request):
current_date = date.today()
days_before = date.today()-timedelta(days=30)
for dt in daterange(days_before,current_date):
reports = Customer_Requests.objects.filter(arrival_date__gte=dt).\
extra({'day':"date(arrival_date)"}).\
values('arrival_date').annotate(count=Count('request_name'))
print(reports)
And I need help
-- TUYIZERE Eugene
Msc Degree in Mathematical Science
African Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, Cameroon
Crystal Garden-Lime, Cameroon
Bsc in Computer Science
UR-Nyagatare Campus
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHstWyfMVKQhJb%3DxGKff3p3V%2BFQ_w3DkYVpOe-pEW2ySKg%40mail.gmail.com.
No comments:
Post a Comment