2017-09-18 21:42:29 +08:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
2020-01-21 17:29:54 +08:00
|
|
|
class Classification(models.Model):
|
|
|
|
code = models.CharField(max_length=10)
|
|
|
|
|
|
|
|
|
2017-09-18 21:42:29 +08:00
|
|
|
class Employee(models.Model):
|
|
|
|
name = models.CharField(max_length=40, blank=False, null=False)
|
|
|
|
salary = models.PositiveIntegerField()
|
|
|
|
department = models.CharField(max_length=40, blank=False, null=False)
|
|
|
|
hire_date = models.DateField(blank=False, null=False)
|
2018-07-26 07:45:32 +08:00
|
|
|
age = models.IntegerField(blank=False, null=False)
|
2020-01-21 17:29:54 +08:00
|
|
|
classification = models.ForeignKey('Classification', on_delete=models.CASCADE, null=True)
|
2020-09-22 21:01:52 +08:00
|
|
|
bonus = models.DecimalField(decimal_places=2, max_digits=15, null=True)
|