2012-05-12 15:24:20 +08:00
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
2013-11-03 05:34:05 +08:00
|
|
|
|
2012-05-12 15:24:20 +08:00
|
|
|
class Account(models.Model):
|
|
|
|
num = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Person(models.Model):
|
2018-12-10 22:28:49 +08:00
|
|
|
GENDER_CHOICES = (
|
|
|
|
('M', 'Male'),
|
|
|
|
('F', 'Female'),
|
|
|
|
)
|
2012-05-12 15:24:20 +08:00
|
|
|
name = models.CharField(max_length=20)
|
|
|
|
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
|
2012-08-13 03:17:54 +08:00
|
|
|
pid = models.IntegerField(null=True, default=None)
|
2012-05-12 15:24:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Employee(Person):
|
|
|
|
employee_num = models.IntegerField(default=0)
|
2015-07-22 22:43:21 +08:00
|
|
|
profile = models.ForeignKey('Profile', models.SET_NULL, related_name='profiles', null=True)
|
2014-07-09 04:42:40 +08:00
|
|
|
accounts = models.ManyToManyField('Account', related_name='employees', blank=True)
|
2012-05-12 15:24:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Profile(models.Model):
|
|
|
|
name = models.CharField(max_length=200)
|
|
|
|
salary = models.FloatField(default=1000.0)
|
|
|
|
|
|
|
|
|
|
|
|
class ProxyEmployee(Employee):
|
|
|
|
class Meta:
|
|
|
|
proxy = True
|