Commit 88c185ed authored by Caryn Lopez-Go's avatar Caryn Lopez-Go Committed by Ysabella Panghulan

renamed assignments app

parent 4b26c8d3
...@@ -3,4 +3,4 @@ from django.apps import AppConfig ...@@ -3,4 +3,4 @@ from django.apps import AppConfig
class AssignmentsConfig(AppConfig): class AssignmentsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = 'django.db.models.BigAutoField'
name = 'Assignments' name = 'assignments'
# Generated by Django 4.1.7 on 2023-03-04 14:58 # Generated by Django 4.1.7 on 2023-03-05 05:46
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
...@@ -28,7 +28,7 @@ class Migration(migrations.Migration): ...@@ -28,7 +28,7 @@ class Migration(migrations.Migration):
('name', models.CharField(max_length=50)), ('name', models.CharField(max_length=50)),
('description', models.TextField(max_length=500)), ('description', models.TextField(max_length=500)),
('perfect_score', models.IntegerField(default=0)), ('perfect_score', models.IntegerField(default=0)),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Assignments.course')), ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assignments.course')),
], ],
), ),
] ]
...@@ -15,9 +15,9 @@ class Assignment(models.Model): ...@@ -15,9 +15,9 @@ class Assignment(models.Model):
course = models.ForeignKey(Course, on_delete=models.CASCADE) course = models.ForeignKey(Course, on_delete=models.CASCADE)
perfect_score = models.IntegerField(default=0) perfect_score = models.IntegerField(default=0)
def save(self,*args,**kwargs): @property
self.passing_score = int(self.perfect_score*0.6) def passing_score(self):
super(Assignment, self).save(*args,**kwargs) return round(self.perfect_score*0.6)
def __str__(self): def __str__(self):
return self.name return self.name
\ No newline at end of file
...@@ -35,13 +35,14 @@ ALLOWED_HOSTS = [] ...@@ -35,13 +35,14 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'Assignments.apps.AssignmentsConfig', 'assignments.apps.AssignmentsConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_rename_app',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
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