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 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 ...@@ -2,7 +2,7 @@ from django.db import models
class Course(models.Model): 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,) course_title = models.CharField(unique=True, default="", max_length=50,)
def __str__(self): def __str__(self):
......
...@@ -9,10 +9,10 @@ def index(request): ...@@ -9,10 +9,10 @@ def index(request):
head = "<h1 style='border-bottom:4px solid lightgray;\ head = "<h1 style='border-bottom:4px solid lightgray;\
padding-bottom:30px;\ padding-bottom:30px;\
font-size:500%;'>\ font-size:500%;'>\
Welcome to Widget!\ Widget's assignment page\
</h1>" </h1>\n"
body = "<h2>WIDGET USERS:</h2>" body = ""
for subject in Assignment.objects.all(): for subject in Assignment.objects.all():
body += "<p style='border: 2px solid gray;\ body += "<p style='border: 2px solid gray;\
...@@ -26,8 +26,7 @@ def index(request): ...@@ -26,8 +26,7 @@ def index(request):
</p>" </p>"
return_string = "<html>\ return_string = "<html>\
<body style = 'font-family:helvetica;\ <body>\
padding:30px;'>\
{}{}\ {}{}\
</body></html>".format(head, 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