fixed passing_score field for assignments on the admin page

parent 6369fd8c
......@@ -5,7 +5,9 @@ from .models import Course
class AssignmentAdmin(admin.ModelAdmin):
readonly_fields = ('id',)
readonly_fields = ('passing_score', 'id',)
fields = ('name', 'description', 'max_points', 'passing_score', 'image')
fields += ('id',)
class CourseAdmin(admin.ModelAdmin):
......
# Generated by Django 4.0.3 on 2022-05-17 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignments', '0007_alter_assignment_image'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='passing_score',
field=models.IntegerField(default=6, editable=False),
),
]
......@@ -7,7 +7,7 @@ class Assignment(models.Model):
name = models.CharField(max_length=120)
description = models.TextField(blank=True)
max_points = models.IntegerField(default=10)
passing_score = models.IntegerField(default=6)
passing_score = models.IntegerField(default=6, editable=False)
image = models.ImageField(null=True, blank=True, upload_to=images_dir)
def save(self, *args, **kwargs):
......
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