from django.db import models
class Area(models.Model):
areaname = models.CharField(max_length=20)
def __str__(self):
return self.areanme
class Meta:
ordering = ['areaname']
class Admin:
pass
class Dept(models.Model):
deptname = models.CharField(max_length=20)
def __str__(self):
return self.deptname
class Meta:
ordering = ['deptname']
class Admin:
pass
class Employee(models.Model):
employee_area = models.ForeignKey(Area)
employee_dept = models.ForeignKey(Dept)
name = models.CharField(max_length=20)
en_name = models.CharField(max_length=40)
tel = models.CharField(max_length=20)
cell_phone = models.CharField(max_length=20)
email = models.CharField(max_length=40)
def __str__(self):
return self.name
class Meta:
ordering = ['employee_area', 'employee_dept', 'name']
class Admin:
pass