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 / settings.py
Created November 30, 2012 15:54
needhelp
# Django settings for podonamu project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '[email protected]'),
)
MANAGERS = ADMINS
@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)
@jjangdm
jjangdm / replace.py
Created December 4, 2012 09:55
please
def report(request):
today = datetime.datetime.now()
executor = Executor.objects.all()
budget_out1 = sum(Budget.objects.filter(year=today.year).values_list("out1", flat=True))
budget_out2 = sum(Budget.objects.filter(year=today.year).values_list("out2", flat=True))
budget_out3 = sum(Budget.objects.filter(year=today.year).values_list("out3", flat=True))
budget_out4 = sum(Budget.objects.filter(year=today.year).values_list("out4", flat=True))
budget_out5 = sum(Budget.objects.filter(year=today.year).values_list("out5", flat=True))
budget_out6 = sum(Budget.objects.filter(year=today.year).values_list("out6", flat=True))
@jjangdm
jjangdm / please.py
Created December 4, 2012 10:25
I tried..
li = []
for i in range(1,26):
li.append(x[i])
@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 / 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 / helpMe.py
Created December 8, 2012 07:28
model concept
from django.db import models
class Member(models.Model):
name = models.CharField(max_length=30, verbose_name='name')
email = models.EmailField(verbose_name='email', blank=True)
birth = models.DateField(verbose_name='birthday', blank=True)
rdate = models.DateField(verbose_name='reg.date')
def __unicode__(self):
return self.name
class Meta:
1. <input type="date" name="date" />
2. views.py
def search(request):
today = datetime.datetime.now()
if 'date' in request.POST and request.POST['date']:
date = request.POST['date']
date_sallary = Sallary.objects.filter(date=today.date)
class Out1(models.Model):
money = models.IntegerField(verbose_name=META_NAME[1])
date = models.DateField(verbose_name='집행일')
executor = models.ForeignKey(Executor, verbose_name='집행자')
comment = models.TextField(blank=True, verbose_name='메모')
week = models.IntegerField(blank=True)
def save(self, *args, **kwargs):
if not self.week:
self.week = self.date.isocalendar()[1]
return super(Out1, self).save(*args, **kwargs)
def searched_day(request):
today = datetime.datetime.now()
if 'sdate' in request.POST and request.POST['sdate']:
sdate = request.POST['sdate']
date_etc = M_etc.objects.filter(date=sdate)
...
...
...