Commit 65da053d authored by Albert Gagalac's avatar Albert Gagalac

Added model-Assignment and its admin panel

parent 6dcb6640
from django.contrib import admin
# Register your models here.
from .models import Assignment
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
# Generated by Django 4.1.7 on 2023-03-04 12:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Assignments",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(default="", max_length=50)),
("description", models.TextField(default="", max_length=700)),
("course", models.CharField(default="", max_length=50)),
("perfect_score", models.PositiveIntegerField(default=0)),
],
),
]
from django.db import models
# Create your models here.
class Assignment(models.Model):
name = models.CharField(default="", max_length=50)
description = models.TextField(default="", max_length=700)
course = models.CharField(default="", max_length=50)
perfect_score = models.PositiveIntegerField(default=0)
def __str__(self):
return self.name
@property
def pass_score(self):
passing_score = self.perfect_score * (60/100)
return passing_score
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