from django.db import models

from django.contrib.auth.models import User
# Create your models here.


class CompletedCourse(models.Model):
    """
    Model for completed studies
    """
    student = models.ForeignKey(User, related_name='completed_courses') 
    code = models.CharField(max_length=11)
    name = models.CharField(max_length=100)
    cr = models.IntegerField()
    ocr = models.IntegerField()
    grade = models.CharField(max_length=5)
    date = models.DateField()
    teacher = models.CharField(max_length=60)
    
class Teacher(models.Model):
    """
    should be updated for the teachers to combine them with course information
    """
    name = models.CharField(max_length = 30)

from django.db import models

from django.contrib.auth.models import User
# Create your models here.


class CompletedCourse(models.Model):
    """
    Model for completed studies
    """
    student = models.ForeignKey(User, related_name='completed_courses')
    code = models.CharField(max_length=11)
    name = models.CharField(max_length=100)
    cr = models.IntegerField(null=True)
    ocr = models.IntegerField(null=True)
    grade = models.CharField(max_length=5)
    date = models.DateField()
    teacher = models.CharField(max_length=60)

class Teacher(models.Model):
    """
    should be updated for the teachers to combine them with course information
    """
    name = models.CharField(max_length = 30)

Allow null values for ocr and cr fields of CompletedCourse
Allow null values for ocr and cr fields of CompletedCourse

  from django.db import models
  
  from django.contrib.auth.models import User
  # Create your models here.
  
  
  class CompletedCourse(models.Model):
      """
      Model for completed studies
      """
-     student = models.ForeignKey(User, related_name='completed_courses') 
+     student = models.ForeignKey(User, related_name='completed_courses')
      code = models.CharField(max_length=11)
      name = models.CharField(max_length=100)
-     cr = models.IntegerField()
+     cr = models.IntegerField(null=True)
-     ocr = models.IntegerField()
+     ocr = models.IntegerField(null=True)
      grade = models.CharField(max_length=5)
      date = models.DateField()
      teacher = models.CharField(max_length=60)
-     
+ 
  class Teacher(models.Model):
      """
      should be updated for the teachers to combine them with course information
      """
      name = models.CharField(max_length = 30)
  
Allow null values for ocr and cr fields of CompletedCourse
## Code Before:
from django.db import models

from django.contrib.auth.models import User
# Create your models here.


class CompletedCourse(models.Model):
    """
    Model for completed studies
    """
    student = models.ForeignKey(User, related_name='completed_courses') 
    code = models.CharField(max_length=11)
    name = models.CharField(max_length=100)
    cr = models.IntegerField()
    ocr = models.IntegerField()
    grade = models.CharField(max_length=5)
    date = models.DateField()
    teacher = models.CharField(max_length=60)
    
class Teacher(models.Model):
    """
    should be updated for the teachers to combine them with course information
    """
    name = models.CharField(max_length = 30)

## Instruction:
Allow null values for ocr and cr fields of CompletedCourse
## Code After:
from django.db import models

from django.contrib.auth.models import User
# Create your models here.


class CompletedCourse(models.Model):
    """
    Model for completed studies
    """
    student = models.ForeignKey(User, related_name='completed_courses')
    code = models.CharField(max_length=11)
    name = models.CharField(max_length=100)
    cr = models.IntegerField(null=True)
    ocr = models.IntegerField(null=True)
    grade = models.CharField(max_length=5)
    date = models.DateField()
    teacher = models.CharField(max_length=60)

class Teacher(models.Model):
    """
    should be updated for the teachers to combine them with course information
    """
    name = models.CharField(max_length = 30)
