Commit d0500ab8 authored by Deokhyun Lee's avatar Deokhyun Lee

all the fields are now defined with passing_score

parent 89ad08ba
from django.db import models
# Create your models here.
# Course
# code; title; section;
class Course(models.Model):
code = models.CharField(max_length = 10)
title = models.CharField(max_length = 100)
section = models.CharField(max_length = 3)
# Assignments
# name; description; course; perfect_score; passing_score
class Assignments(models.Model):
name = models.CharField(max_length = 100)
description = models.CharField(max_length = 1000)
course = models.ForeignKey(Course, on_delete = models.CASCADE)
perfect_score = models.IntegerField(default = 0)
passing_score = models.IntegerField(default = 0)
# calculates a passing score based on perfect score with 60%
@property
def passing_score_calculated(self, value):
self.passing_score = int(value * 0.6)
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