Admin panel has been created

parent fcc5c853
from django.contrib import admin
from .models import Course, Assignment
# Register your models here.
class CourseAdmin(admin.ModelAdmin):
model = Course
search_fields = ('code', 'title')
list_display = ('code', 'title', 'section')
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
search_fields = ('name', 'course')
list_display = ('name', 'description', 'course', 'perfect_score', 'passing_score')
admin.site.register(Course, CourseAdmin)
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
# Generated by Django 3.2 on 2023-03-03 15:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
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=100)),
('section', models.CharField(max_length=3)),
],
),
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('description', models.TextField()),
('perfect_score', models.IntegerField()),
('course', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Assignments.course')),
],
),
]
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