Commit 88cd26db authored by rachbit's avatar rachbit

created admin panel and populated models of app assignments

parent 67339cd3
# Generated by Django 4.1.7 on 2023-03-06 06:16
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField()),
('course', models.TextField()),
('perfect_score', models.IntegerField()),
],
),
migrations.CreateModel(
name='Course',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(max_length=10)),
('title', models.CharField(max_length=255)),
('section', models.CharField(max_length=3)),
],
),
]
# Generated by Django 4.1.7 on 2023-03-06 06:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('assignments', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='course',
field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='assignments.course'),
),
]
from django.db import models
class Course(models.Model):
code = models.CharField(max_length=10)
title = models.CharField(max_length=255)
section = models.CharField(max_length=3)
def __str__(self):
return '{}'.format(self.code)
class Assignment(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
course = models.TextField()
course = models.ForeignKey(Course,on_delete=models.CASCADE,default="")
perfect_score = models.IntegerField()
def __str__(self):
......@@ -12,12 +21,3 @@ class Assignment(models.Model):
def passing_score(self):
return (self.perfect_score * 60)//100
class Course(models.Model):
code = models.CharField(max_length=10)
title = models.CharField(max_length=255)
section = models.CharField(max_length=3)
def __str__(self):
return '{}'.format(self.code)
......@@ -2,4 +2,4 @@ from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse('Hello World! This is assignments')
return HttpResponse('Hello World! This is assignments')
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