Commit 67339cd3 authored by rachbit's avatar rachbit

implemented modelels of app assignments

parent f976335a
from django.contrib import admin from django.contrib import admin
from .models import Assignment, Course
# Register your models here. class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
list_display = ('name','description','course','perfect_score', 'passing_score')
class CourseAdmin(admin.ModelAdmin):
model = Course
list_display = ('code','title','section')
admin.site.register(Assignment, AssignmentAdmin)
admin.site.register(Course, CourseAdmin)
from django.db import models from django.db import models
# Create your models here. class Assignment(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
course = models.TextField()
perfect_score = models.IntegerField()
def __str__(self):
return '{}'.format(self.name)
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)
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