Skip to content

Instantly share code, notes, and snippets.

@manuelgeek
Created May 4, 2020 11:28
Show Gist options
  • Save manuelgeek/cb9ff28349dd46705bd58d645f974068 to your computer and use it in GitHub Desktop.
Save manuelgeek/cb9ff28349dd46705bd58d645f974068 to your computer and use it in GitHub Desktop.
Simple Django gist to show count
def get_count(self, request, *args, **kwargs):
recons_0 = ReconStatus.objects.filter(ageing_days__range=[0,30], deleted=False).count()
recons_30 = ReconStatus.objects.filter(ageing_days__range=[30,60], deleted=False).count()
recons_60 = ReconStatus.objects.filter(ageing_days__range=[60,90], deleted=False).count()
recons_90 = ReconStatus.objects.filter(ageing_days__gte = 90, deleted=False).count()
return Response({'recons_0': recons_0, 'recons_30': recons_30, 'recons_60': recons_60, 'recons_90': recons_90})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment