Commit e6bfc004 authored by kylemendozaa's avatar kylemendozaa

added default values for assignment model max points and passing score

parent 0fe15686
# Generated by Django 4.0.3 on 2022-04-05 14:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('assignments', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Course',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('course_code', models.CharField(max_length=10)),
('course_title', models.CharField(max_length=50)),
('course_section', models.CharField(max_length=3)),
],
),
migrations.AddField(
model_name='assignment',
name='passing_score',
field=models.IntegerField(default=6),
),
migrations.AlterField(
model_name='assignment',
name='max_points',
field=models.IntegerField(default=10),
),
migrations.AddField(
model_name='assignment',
name='course',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='assignments.course'),
),
]
...@@ -3,13 +3,13 @@ from django.db import models ...@@ -3,13 +3,13 @@ from django.db import models
class Course(models.Model): class Course(models.Model):
course_code = models.CharField(max_length=10) course_code = models.CharField(max_length=10)
course_title = models.CharField(max_length=50) course_title = models.CharField(max_length=50)
course_section = models.CharField(max_lenth=3) course_section = models.CharField(max_length=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(default=10)
passing_score = models.IntegerField() passing_score = models.IntegerField(default=6)
course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True)
def save(self): def save(self):
......
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