Commit 2219c3fa authored by Albert Gagalac's avatar Albert Gagalac

populated models with 3 items; Assignment and Course

parent 3826707d
# Generated by Django 4.1.7 on 2023-03-04 18:32
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("assignments", "0002_assignment_course_delete_assignments_and_more"),
]
operations = [
migrations.AddField(
model_name="assignment",
name="passing_score",
field=models.PositiveIntegerField(default=0),
),
migrations.AlterField(
model_name="course",
name="section",
field=models.CharField(
default="",
max_length=3,
unique=True,
validators=[
django.core.validators.RegexValidator(
"^[a-zA-Z]*$", message="Only letters are allowed"
)
],
),
),
]
# Generated by Django 4.1.7 on 2023-03-04 18:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("assignments", "0003_assignment_passing_score_alter_course_section"),
]
operations = [
migrations.RemoveField(
model_name="assignment",
name="passing_score",
),
]
...@@ -17,6 +17,7 @@ class Course(models.Model): ...@@ -17,6 +17,7 @@ class Course(models.Model):
class Assignment(models.Model): class Assignment(models.Model):
name = models.CharField(default="", max_length=50) name = models.CharField(default="", max_length=50)
description = models.TextField(default="", max_length=700) description = models.TextField(default="", max_length=700)
course = models.ForeignKey(Course, on_delete=models.CASCADE) course = models.ForeignKey(Course, on_delete=models.CASCADE)
...@@ -25,7 +26,13 @@ class Assignment(models.Model): ...@@ -25,7 +26,13 @@ class Assignment(models.Model):
def __str__(self): def __str__(self):
return self.name return self.name
@property #@property
def pass_score(self): def pass_score(self):
passing_score = self.perfect_score * (60/100) passing_score = self.perfect_score * (60/100)
return passing_score return passing_score
# def pass_score(self,*args, **kwargs):
# self.passing_score = self.perfect_score * (60/100)
# super(Assignment, self).save(*args, **kwargs)
\ 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