from django.db import models
from django.contrib.auth.models import User

# Create your models here.

# User     1 zwaapalm
#          2 tabong


class Term(models.Model):   # 1 physics
    semeter =  models.IntegerField()
    year = models.IntegerField()


    def __str__(self):
        return f"{self.semeter}/{self.year}"

class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term,on_delete=models.CASCADE,related_name="c_term",null=True)
    student =  models.ManyToManyField(User, blank=True,related_name="student")
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)


    def __str__(self):
        return f"{self.c_name}"

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return (check)




493efdf43ef3949e6572c62315326ca472892523
<mask token>


class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term, on_delete=models.CASCADE,
        related_name='c_term', null=True)
    student = models.ManyToManyField(User, blank=True, related_name='student')
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)

    def __str__(self):
        return f'{self.c_name}'

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return check

<mask token>


class Term(models.Model):
    <mask token>
    <mask token>
    <mask token>


class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term, on_delete=models.CASCADE,
        related_name='c_term', null=True)
    student = models.ManyToManyField(User, blank=True, related_name='student')
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)

    def __str__(self):
        return f'{self.c_name}'

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return check

<mask token>


class Term(models.Model):
    <mask token>
    <mask token>

    def __str__(self):
        return f'{self.semeter}/{self.year}'


class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term, on_delete=models.CASCADE,
        related_name='c_term', null=True)
    student = models.ManyToManyField(User, blank=True, related_name='student')
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)

    def __str__(self):
        return f'{self.c_name}'

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return check

<mask token>


class Term(models.Model):
    semeter = models.IntegerField()
    year = models.IntegerField()

    def __str__(self):
        return f'{self.semeter}/{self.year}'


class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term, on_delete=models.CASCADE,
        related_name='c_term', null=True)
    student = models.ManyToManyField(User, blank=True, related_name='student')
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)

    def __str__(self):
        return f'{self.c_name}'

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return check

from django.db import models
from django.contrib.auth.models import User

# Create your models here.

# User     1 zwaapalm
#          2 tabong


class Term(models.Model):   # 1 physics
    semeter =  models.IntegerField()
    year = models.IntegerField()


    def __str__(self):
        return f"{self.semeter}/{self.year}"

class Course(models.Model):
    c_name = models.CharField(max_length=200)
    c_code = models.CharField(max_length=10)
    number_of_Applicants = models.IntegerField(default=0)
    seat = models.IntegerField()
    status = models.IntegerField(null=True)
    semeter = models.ForeignKey(Term,on_delete=models.CASCADE,related_name="c_term",null=True)
    student =  models.ManyToManyField(User, blank=True,related_name="student")
    for_year = models.IntegerField(null=True)
    year = models.IntegerField(null=True)


    def __str__(self):
        return f"{self.c_name}"

    def course_sit_avilable(self):
        check = False
        if number_of_Applicants < seat:
            check = True
        return (check)



