2017-09-18 13:42:29 +00:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
2020-01-21 09:29:54 +00:00
|
|
|
class Classification(models.Model):
|
|
|
|
code = models.CharField(max_length=10)
|
|
|
|
|
|
|
|
|
2017-09-18 13:42:29 +00: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-25 23:45:32 +00:00
|
|
|
age = models.IntegerField(blank=False, null=False)
|
2020-01-21 09:29:54 +00:00
|
|
|
classification = models.ForeignKey('Classification', on_delete=models.CASCADE, null=True)
|
2020-09-22 13:01:52 +00:00
|
|
|
bonus = models.DecimalField(decimal_places=2, max_digits=15, null=True)
|
2020-10-14 10:21:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Detail(models.Model):
|
|
|
|
value = models.JSONField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
required_db_features = {'supports_json_field'}
|