added image field under assignment

parent 6ccbe6f5
from django.db import models from django.db import models
images_dir = 'assignments/static/assignments/images'
class Assignment(models.Model): class Assignment(models.Model):
name = models.CharField(max_length=120) name = models.CharField(max_length=120)
description = models.TextField(blank=True) description = models.TextField(blank=True)
max_points = models.IntegerField(default=10) max_points = models.IntegerField(default=10)
passing_score = models.IntegerField(default=6) passing_score = models.IntegerField(default=6)
image = models.ImageField(null=True, blank=True, upload_to=images_dir)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
self.passing_score = int(0.6*self.max_points) self.passing_score = int(0.6*self.max_points)
......
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