Update model value

时间:2018-04-20 01:00:42

标签: django

I need suggestions on how to approach this problem.

Basically I have 3 models

class SGrade(TimeStampedModel):
   subject_sched = models.ForeignKey(SubjectSched)
    final_grade = models.DecimalField(max_digit=5)

class SubjectSched(models.Model):
   subject = models.ForeignKey(Subject)

class Subject(models.Model):
   name = models.CharField(max_length=150) 



class Comp(models.Model):
    subj_sched = models.ForeignKey(SubjectSched)
        name = models.Charfield(max_length=150)
        percentage = models.DecimalField(max_digit=5)

class Grade(TimeStampedModel):
    sgrade = models.ForeignKey(SGrade)
        component = models.ForeignKey(Component)
        grade = models.Decimal(max_digits=5)

I would like to make an updateview with form for each student's grades. I can access the final grade from SGrade model while the subject name is in Subject model. Grades per component is in Grade model and component (e.g. 1st, 2nd, 3rd, 4th quarters ) are in Component. I am currently ready about Formset but still getting the grasp of it.

0 个答案:

没有答案