evg-app-back/organisations/models.py

52 lines
1.6 KiB
Python
Raw Normal View History

2021-01-10 15:51:59 +03:00
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from users.models import Profile
class Role(models.Model):
name = models.CharField(max_length=50)
class Organisation(models.Model):
name = models.TextField()
def __str__(self):
return self.name
class Group(models.Model):
name = models.CharField(max_length=20)
org = models.ForeignKey(Organisation, models.CASCADE, unique=False)
def __str__(self):
return self.name
class Teacher(models.Model):
org = models.ForeignKey(Organisation, models.CASCADE, blank=True)
2021-01-20 22:10:57 +03:00
profile = models.ForeignKey(Profile, models.CASCADE, blank=True)
2021-01-10 15:51:59 +03:00
groups = models.ManyToManyField(Group)
name = models.CharField(max_length=150, blank=True)
surname = models.CharField(max_length=150, blank=True)
midname = models.CharField(max_length=150, blank=True)
class Child(models.Model):
2021-01-20 22:10:57 +03:00
profile = models.ForeignKey(Profile, models.CASCADE, blank=True)
2021-01-10 15:51:59 +03:00
org = models.ForeignKey(Organisation, models.CASCADE, blank=True)
groups = models.ManyToManyField(Group)
name = models.CharField(max_length=150, blank=True)
surname = models.CharField(max_length=150, blank=True)
2021-01-20 22:10:57 +03:00
midname = models.CharField(max_length=150, blank=True)
class Organisator(models.Model):
profile = models.ForeignKey(Profile, models.CASCADE, blank=True)
org = models.ForeignKey(Organisation, models.CASCADE, blank=True)
groups = models.ManyToManyField(Group)
name = models.CharField(max_length=150, blank=True)
surname = models.CharField(max_length=150, blank=True)
midname = models.CharField(max_length=150, blank=True)