48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
# Create your models here.
|
|
import uuid
|
|
|
|
from django.db import models
|
|
|
|
|
|
class LearnBlock:
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
internal_name = models.CharField(max_length=255)
|
|
title = models.CharField(max_length=255)
|
|
|
|
|
|
class LearnPath(LearnBlock):
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class Topic(LearnBlock):
|
|
learn_path = models.ForeignKey(LearnPath, on_delete=models.CASCADE)
|
|
is_visible = models.BooleanField(default=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class Circle(LearnBlock):
|
|
topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
|
|
|
|
description = models.TextField(default="")
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class LearnSequence(LearnBlock):
|
|
circle = models.ForeignKey(Circle, on_delete=models.CASCADE)
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|
|
|
|
|
|
class LernUnit(LearnBlock):
|
|
learn_sequence = models.ForeignKey(LearnSequence, on_delete=models.CASCADE)
|
|
|
|
def __str__(self):
|
|
return f"{self.title}"
|