I have for example a model like this:
class Transaction(models.Model):
amount = models.FloatField()
seller = models.ForeignKey(User, related_name='sells', on_delete=models.CASCADE)
buyer = models.ForeignKey(User, related_name='purchased', on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
I want to group by all transactions seperated by each date and find some of them. If the created_at is of type DateField I could simply find the count on each day by this query:
Transaction.objects..values('created_at').annotate(count=Count('created_at_date')
But this doesn't work DateTimeFeilds.
My question is how can i find total count of transactions for each date for this model type.