Last active
May 22, 2021 11:38
-
-
Save sankalpjonn/cc84f53581b11eeb3ffb452a988662b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
#======= Abstract models =========# | |
class Person(models.Model): | |
name = models.CharField(max_length=255) | |
date_of_birth = models.DateTimeField() | |
date_of_joining = models.DateTimeField() | |
address = models.TextField() | |
class Meta: | |
abstract = True | |
class SchoolEmployee(Person): | |
compensation = models.CharField(max_length=255) | |
class Meta: | |
abstract = True | |
class HiredHelp(SchoolEmployee): | |
shift_timings = models.JSONField() | |
class Meta: | |
abstract = True | |
#--------------------------------# | |
#======= Actual models ==========# | |
class Student(Person): | |
roll_number = models.IntegerField() | |
class Teacher(SchoolEmployee): | |
qualifications = models.JSONField() | |
class CafeteriaEmployee(HiredHelp): | |
pass | |
class CleaningStaffMember(HiredHelp): | |
pass | |
#--------------------------------# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment