from django.db import models from django.conf import settings class UserLabWorkshop(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) workshop = models.ForeignKey( "labs.EventVoucher", on_delete=models.CASCADE, null=True, blank=True, ) workshop_name = models.CharField(max_length=100) lab_group_name = models.CharField(max_length=100) lab_codes = models.JSONField(default=list) valid_from = models.DateTimeField(blank=True, null=True) valid_until = models.DateTimeField(blank=True, null=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: db_table = "user_lab_workshops" unique_together = ("user", "workshop")