from django.db import models from django import forms from .vessel import Vessel from .crew import CrewMember from .course import Course class Moodle(models.Model): vessel = models.OneToOneField(Vessel, models.CASCADE) name = models.CharField(max_length=Vessel.name.field.max_length) url = models.URLField() monitor = models.BooleanField(default=True) backup = models.BooleanField(default=False) class MoodleDatabase(models.Model): instance = models.OneToOneField(Moodle, models.CASCADE) host = models.CharField(max_length=256) username = models.CharField(max_length=256) password = models.CharField(max_length=256) database = models.CharField(max_length=256, default="moodle") class MoodlePlugin(models.Model): name = models.CharField(max_length=128) section = models.CharField(max_length=16) current_version = models.IntegerField() class CourseAssignment(models.Model): crew = models.ForeignKey(CrewMember, models.CASCADE) course = models.ForeignKey(Course, models.CASCADE) instance = models.ForeignKey(Moodle, models.CASCADE, null=True) class CourseAssignmentLog(models.Model): assignment = models.ForeignKey(CourseAssignment, models.CASCADE) instance = models.ForeignKey(Moodle, models.CASCADE) timestamp = models.DateTimeField(auto_now_add=True)