Commit e073ed3d authored by Star Neptune R. Sy's avatar Star Neptune R. Sy

first version of admin panel done

parent e3adc642
from django.contrib import admin
from .models import Assignment, Course
# Register your models here.
class AssignmentInline(admin.StackedInline):
model = Assignment
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
list_display = ('assignment_name', 'section')
search_fields = ('course',)
list_filter = ('section', 'perfect_score', 'passing_score')
class CourseAdmin(admin.ModelAdmin):
model = Course
list_display = ('course_code', 'course_title',)
search_fields = ('course_code', 'course_title',)
list_filter = ('course_code', 'course_title',)
admin.site.register(Course, CourseAdmin)
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
......@@ -2,7 +2,7 @@ from django.db import models
class Course(models.Model):
course_code = models.CharField(unique=True, default="", max_length=50,)
course_code = models.CharField(unique=True, default="", max_length=10,)
course_title = models.CharField(unique=True, default="", max_length=50,)
def __str__(self):
......
......@@ -9,10 +9,10 @@ def index(request):
head = "<h1 style='border-bottom:4px solid lightgray;\
padding-bottom:30px;\
font-size:500%;'>\
Welcome to Widget!\
</h1>"
Widget's assignment page\
</h1>\n"
body = "<h2>WIDGET USERS:</h2>"
body = ""
for subject in Assignment.objects.all():
body += "<p style='border: 2px solid gray;\
......@@ -26,8 +26,7 @@ def index(request):
</p>"
return_string = "<html>\
<body style = 'font-family:helvetica;\
padding:30px;'>\
<body>\
{}{}\
</body></html>".format(head, body)
......
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