Skip to content

Instantly share code, notes, and snippets.

@jjangdm
Created December 3, 2012 13:59
Show Gist options
  • Save jjangdm/4195210 to your computer and use it in GitHub Desktop.
Save jjangdm/4195210 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment