Commit 802e8714 authored by Brescia Amandy's avatar Brescia Amandy

Added list filters and search function to the admin page

parent d250bebc
......@@ -6,9 +6,17 @@ from .models import Assignment, Course
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
list_display = ('name', 'description', 'course', 'perfect_score', 'passing_score')
search_fields = ('name', 'description', 'course', 'perfect_score')
list_filter = ('name', 'course', 'perfect_score')
class CourseAdmin(admin.ModelAdmin):
model = Course
list_display = ('code', 'title', 'section')
search_fields = ('code', 'title', 'section')
admin.site.register(Assignment, AssignmentAdmin)
admin.site.register(Course, CourseAdmin)
......@@ -2,6 +2,7 @@ from django.urls import path
from .views import assignments
urlpatterns = [
path('', assignments, name='assignments'),
]
......
......@@ -3,6 +3,7 @@ from django.http import HttpResponse
from .models import Assignment, Course
def assignments(request):
return_string = "Widget's Assignments Page<br><br>"
for assignment, course in zip(Assignment.objects.all(), Course.objects.all()):
......
......@@ -16,6 +16,7 @@ Including another URLconf
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('assignments/', include('assignments.urls', namespace="assignments")),
path('admin/', admin.site.urls),
......
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