30 lines
1012 B
Python
30 lines
1012 B
Python
from django.db import models
|
|
from django.db.models import UniqueConstraint
|
|
|
|
from vbv_lernwelt.core.models import User
|
|
|
|
|
|
class CircleCompletion(models.Model):
|
|
# Page can either be a LearningContent or a LearningUnitQuestion for now
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
|
|
# Page can either be a LearningContent or a LearningUnitQuestion for now
|
|
page_key = models.UUIDField()
|
|
page_type = models.CharField(max_length=255, default='', blank=True)
|
|
circle_key = models.UUIDField(blank=True, default='')
|
|
learning_path_key = models.UUIDField(blank=True, default='')
|
|
|
|
completed = models.BooleanField(default=False)
|
|
json_data = models.JSONField(default=dict, blank=True)
|
|
|
|
class Meta:
|
|
constraints = [
|
|
UniqueConstraint(
|
|
fields=['user', 'page_key', ],
|
|
name='unique_user_page_key'
|
|
)
|
|
]
|