Commits

Maciej Wiśniowski committed 23ddeb4

total stats

Comments (0)

Files changed (1)

dj_banner/models.py

             return BannerMonthCounter.objects.filter(month__in=month, banner=self)
         return BannerMonthCounter.objects.get_or_create(month=month, banner=self)[0]
 
+    def get_total_stat(self):
+        return BannerMonthCounter.objects.filter(banner=self).aggregate(clicks_sum=models.Sum('clicks'),
+                                                                          views_sum=models.Sum('views'))
+
     def __unicode__(self):
         return ugettext(u'Banner: %s') % self.title