Пример #1
0
class SubmissionHistoryItem(FkSerializableModel):
    submission = models.ForeignKey(Submission, on_delete=models.CASCADE)
    submission_history_id = cgf.CanvasIdField()

    class Meta:
        unique_together = ("submission", "submission_history_id")

    def __str__(self):
        return "submission history item {} for {}".format(
            self.submission_history_id, str(self.submission))
Пример #2
0
class Course(FkSerializableModel):
    course_id = cgf.CanvasIdField()
    name = models.CharField(max_length=100, blank=False, null=False)
    created_at = models.DateTimeField()
    domain = models.ForeignKey(Domain, on_delete=models.CASCADE)

    class Meta:
        unique_together = ("course_id", "domain")

    def __str__(self):
        return self.name
Пример #3
0
class Quiz(FkSerializableModel):
    assignment = models.ForeignKey(Assignment, on_delete=models.CASCADE)
    quiz_id = cgf.CanvasIdField()
    speed_grader_url = models.URLField(null=True)
    question_count = models.IntegerField()

    class Meta:
        unique_together = ("assignment", "quiz_id")

    def __str__(self):
        return str(self.assignment)
Пример #4
0
class CanvasUser(FkSerializableModel):
    user_id = cgf.CanvasIdField()
    name = models.CharField(max_length=50, blank=False, null=False)
    sortable_name = models.CharField(max_length=50, blank=False, null=False)
    domain = models.ForeignKey(Domain, on_delete=models.CASCADE)

    class Meta:
        unique_together = ("user_id", "domain")

    def __str__(self):
        return self.name
Пример #5
0
class Submission(FkSerializableModel):
    submission_id = cgf.CanvasIdField()
    assignment = models.ForeignKey(Assignment, on_delete=models.CASCADE)
    posted_at = models.DateTimeField(null=True)
    preview_url = models.URLField()
    canvas_user = models.ForeignKey(CanvasUser, on_delete=models.CASCADE)

    class Meta:
        unique_together = ("assignment", "submission_id")

    def __str__(self):
        return "submission by {} for {}".format(str(self.canvas_user),
                                                str(self.assignment))
Пример #6
0
class Assignment(FkSerializableModel):
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    assignment_id = cgf.CanvasIdField()
    name = models.CharField(max_length=50, blank=False, null=False)
    points_possible = models.FloatField()
    created_at = models.DateTimeField()
    updated_at = models.DateTimeField()
    html_url = models.URLField()

    class Meta:
        unique_together = ("assignment_id", "course")

    def __str__(self):
        return self.name
Пример #7
0
class QuizQuestion(FkSerializableModel):
    quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE)
    question_id = cgf.CanvasIdField()
    question_name = models.CharField(max_length=100, blank=False, null=False)
    question_text = models.TextField()
    quiz_question_group = models.ForeignKey(QuizQuestionGroup,
                                            on_delete=models.CASCADE,
                                            null=True)
    question_type = models.CharField(max_length=50)
    points_possible = models.FloatField()

    class Meta:
        unique_together = ("quiz", "question_id")

    def __str__(self):
        return self.question_name
Пример #8
0
class QuizQuestionGroup(FkSerializableModel):
    quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE)
    group_id = cgf.CanvasIdField()

    class Meta:
        unique_together = ("quiz", "group_id")