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