Commit 0fe15686 authored by kylemendozaa's avatar kylemendozaa

added course model

parent 3bb51b77
from django.db import models from django.db import models
class Course(models.Model):
course_code = models.CharField(max_length=10)
course_title = models.CharField(max_length=50)
course_section = models.CharField(max_lenth=3)
class Assignment(models.Model): class Assignment(models.Model):
name = models.CharField(max_length=30) name = models.CharField(max_length=30)
description = models.TextField() description = models.TextField()
max_points = models.IntegerField() max_points = models.IntegerField()
passing_score = models.IntegerField() passing_score = models.IntegerField()
course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True)
def save(self): def save(self):
self.passing_score = int(0.6*self.max_points) self.passing_score = int(0.6*self.max_points)
super(Assignment, self).save() super(Assignment, self).save()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment