Skip to content

Instantly share code, notes, and snippets.

@jjangdm
Created February 22, 2013 09:50
Show Gist options
  • Save jjangdm/5012178 to your computer and use it in GitHub Desktop.
Save jjangdm/5012178 to your computer and use it in GitHub Desktop.
109번째줄은 맨 밑에서 위로 두번째입니다
class Income(models.Model):
date = models.DateField(verbose_name=u"날짜", auto_now_add=True)
item = models.ForeignKey(Item, verbose_name=u"항목")
member = models.ForeignKey(Member, verbose_name=u"이름", blank=True, null=True)
money = models.IntegerField(verbose_name=u"금액")
comment = models.TextField(blank=True, verbose_name=u"비고")
week = models.IntegerField(blank=True, verbose_name=u"주차", editable=False)
class Meta:
ordering = ["-date", "item"]
verbose_name = u"수입"
verbose_name_plural = u"수입"
def __unicode__(self):
return u"%s from %s: %s" % self.item.title, self.member.name, self.money
def save(self, *args, **kwargs):
if not self.week:
self.week = self.date.isocalendar()[1]
super(Income, self).save(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment