from django.db import models
from .student import Student
from .section import Section


class StudentInSection(models.Model):
    """A class that inherits from the model class which 
    create a StudentInSection model.This StudentInSection
    model defines a datastore entity.
    This class is ordering by student. 

    Args:
        models (_type_): model class

    Returns:
        _type_: string object (StudentInSection.student.user.username and StudentInSection.section)
    """
    student = models.ForeignKey(Student, on_delete=models.DO_NOTHING)
    section = models.ForeignKey(Section, on_delete=models.DO_NOTHING)

    evaluated = models.BooleanField(default=False)

    def __str__(self) -> str:
        return f'{self.student.user.username} in {self.section} sections'

    class Meta:
        ordering = ['student']
