Created
February 22, 2013 09:50
-
-
Save jjangdm/5012178 to your computer and use it in GitHub Desktop.
109번째줄은 맨 밑에서 위로 두번째입니다
This file contains 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 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