No Description

models.py 1.5KB

12345678910111213141516171819202122232425262728293031323334
  1. from django.db import models
  2. from django.contrib.auth.models import AbstractUser
  3. # Create your models here.
  4. # diego, Diego1999$
  5. class Facultad(models.Model):
  6. fname = models.CharField(max_length=150)
  7. class Curso(models.Model):
  8. fac_id = models.ForeignKey(Facultad, on_delete=models.CASCADE)
  9. name = models.CharField(max_length=150)
  10. code = models.CharField(max_length=9)
  11. creditos = models.IntegerField(default=0)
  12. class User(AbstractUser):
  13. gpa = models.DecimalField(default = 0, max_digits = 3, decimal_places = 2)
  14. fac_id = models.ForeignKey(Facultad, on_delete=models.CASCADE, default=1)
  15. credits_taken = models.IntegerField(default=0)
  16. credits_taken_score = models.IntegerField(default=0)
  17. class Matricula(models.Model):
  18. user_id = models.ForeignKey(User, on_delete=models.CASCADE, default=1)
  19. course_id = models.ForeignKey(Curso, on_delete=models.CASCADE, default=1)
  20. section = models.CharField(max_length=5, null=True, blank=True)
  21. prof = models.CharField(max_length=150, null=True, blank=True)
  22. semestre = models.IntegerField(default=0, null=False, blank=False)
  23. year = models.IntegerField(default=0, null=False, blank=False)
  24. # fecha = models.CharField(max_length=150, null=False, blank=True)
  25. grade = models.CharField(max_length=3, default = 'N')
  26. salones =models.CharField(max_length=100,blank=True, null=True)
  27. horarios =models.CharField(max_length=150,blank=True, null=True)
  28. dias =models.CharField(max_length=100,blank=True, null=True)