Skip to content

Instantly share code, notes, and snippets.

@jjangdm
Created December 8, 2012 07:28
Show Gist options
  • Save jjangdm/4239130 to your computer and use it in GitHub Desktop.
Save jjangdm/4239130 to your computer and use it in GitHub Desktop.
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:
ordering = ['name']
verbose_name = 'members'
class Asset(models.Model):
name = models.ForeignKey(Member, verbose_name='name')
money = models.IntegerField(verbose_name='money',blank=True)
date = models.DateField(verbose_name='date')
def __unicode__(self):
return self.name.name
class Meta:
ordering = ['-date']
verbose_name = 'asset'
class Salary(models.Model):
name = models.ForeignKey(Member, verbose_name='name')
money = models.IntegerField(verbose_name='money',blank=True)
date = models.DateField(verbose_name='date')
def __unicode__(self):
return self.name.name
class Meta:
ordering = ['-date']
verbose_name = 'salary'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment