How can I count the fields of All Objects in a Database Table by date in Django?
For example: I can access the number of all records of my model named "MateryalEkle" with this code below {{materyalIstatistik}}.
But I want to reach the count of all fields separately. And I want to do them by date range i.e. weekly, monthly and yearly.
for example: how many "TELEFON", how many "SIM KART", how many "SD KART".
and I want to filter these count by date range.
for example : 01.03.2021 - 07.03.2021 or 01.01.2021 -.01.01.2022
How can I do that? Thanks for your help.
models.py
 class MateryalEkle(models.Model):
       
        MATERYALCINSI = [
        ('TELEFON', 'TELEFON'),
        ('SIM KART', 'SIM KART'),
        ('SD KART', 'SD KART'),
        ('USB BELLEK', 'USB BELLEK'),
    ]
        materyalMarka = models.CharField(max_length=50, verbose_name='MATERYAL MARKA', blank=True, null=True, default="-")
        cinsi = models.CharField(max_length=50, choices=MATERYALCINSI, verbose_name='MATERYAL CİNSİ', blank=True, null=True, default="-")
        gelisTarihi = models.DateTimeField(auto_now_add=True)
        slug = AutoSlugField(populate_from='materyalMarka', unique=True, blank=True, null=True)
        def __str__(self):
            return self.materyalMarka
views.py
def istatistik(request): materyalIstatistik = MateryalEkle.objects.all().count()
return render(request, 'delil/istatistikler.html', {'materyalIstatistik':materyalIstatistik})
istatistikler.html
`<p>materyal : {{materyalIstatistik}} </p>`
 
    