This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def report(request): | |
| today = datetime.datetime.now() | |
| executor = Executor.objects.all() | |
| budgets = {'management_budgets': ['out1', 'out2', 'out3', 'out4'], | |
| 'education_budgets': ['out5', 'out6', 'out7'], | |
| 'feed_budgets': ['out8', 'out9', 'out10', 'out11', 'out12', 'out13'], | |
| 'reward_budgets': ['out14', 'out15', 'out16'], | |
| 'mission_budgets': ['out17', 'out18', 'out19', 'out20', 'out21'], | |
| 'operation_budgets': ['out22', 'out23', 'out24', 'out25']} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def report(request): | |
| today = datetime.datetime.now() | |
| executor = Executor.objects.all() | |
| queryset = Budget.objects.filter(year=today.year) | |
| aggregates = {} | |
| for i in xrange(1, 25+1): | |
| aggregates['out%d' % i] = models.Sum('out%d' % i) | |
| budget = queryset.aggregate(**aggregates) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Money(models.Model): | |
| date = models.DateField() | |
| week = models.IntegerField(blank=True) | |
| def save(self, *args, **kwargs): | |
| if not self.week: | |
| self.week = self.date.isocalendar()[1] | |
| return super(Money, self).save(*args, **kwargs) | |