mirror of
https://github.com/evgen-app/evg-app-back.git
synced 2024-11-24 17:53:44 +03:00
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
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)
|
|
profile = models.ForeignKey(Profile, 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)
|
|
|
|
class Child(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)
|
|
|
|
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)
|