Skip to content

Instantly share code, notes, and snippets.

View jjangdm's full-sized avatar

JANGDONGMIN jjangdm

  • I'm free.
  • Suwon-city
View GitHub Profile
@jjangdm
jjangdm / replace.py
Created December 4, 2012 15:11 — forked from toracle/replace.py
please
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']}
@jjangdm
jjangdm / replace.py
Created December 4, 2012 15:10 — forked from dittos/replace.py
please
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)
@jjangdm
jjangdm / pocket money
Created December 3, 2012 13:59
money class
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)