mirror of
https://github.com/encounter/decomp.me.git
synced 2026-03-30 11:06:27 -07:00
9651b7dcf2
Fixes #312 - removes login event from plausible Fixes #249 - adds the course db models Fixes #583 - allow viewing target asm even when the scratch doesn't initially compile Update frontend & backend deps
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from django.db import models
|
|
|
|
from coreapp.models.scratch import Scratch
|
|
|
|
|
|
class Course(models.Model):
|
|
slug = models.SlugField(max_length=100, unique=True)
|
|
name = models.CharField(max_length=500)
|
|
description = models.TextField()
|
|
|
|
def __str__(self) -> str:
|
|
return self.name
|
|
|
|
|
|
class CourseChapter(models.Model):
|
|
course = models.ForeignKey(
|
|
Course, on_delete=models.CASCADE, related_name="chapters"
|
|
)
|
|
index = models.IntegerField()
|
|
slug = models.SlugField(max_length=100)
|
|
name = models.CharField(max_length=500)
|
|
description = models.TextField()
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.course.name} - {self.name}"
|
|
|
|
|
|
class CourseScenario(models.Model):
|
|
chapter = models.ForeignKey(
|
|
CourseChapter, on_delete=models.CASCADE, related_name="scenarios"
|
|
)
|
|
index = models.IntegerField()
|
|
slug = models.SlugField(max_length=100)
|
|
name = models.CharField(max_length=500)
|
|
content = models.TextField()
|
|
scratch = models.ForeignKey(Scratch, on_delete=models.PROTECT)
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.chapter.course.name} - {self.chapter.name} - {self.name}"
|