説明なし

models.py 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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=15)
  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. current_year = models.IntegerField(default=1)
  18. current_semester = models.IntegerField(default=1)
  19. class Matricula(models.Model):
  20. user_id = models.ForeignKey(User, on_delete=models.CASCADE, default=1)
  21. course_id = models.ForeignKey(Curso, on_delete=models.CASCADE, default=1)
  22. section = models.CharField(max_length=5, null=True, blank=True)
  23. prof = models.CharField(max_length=150, null=True, blank=True)
  24. semestre = models.IntegerField(default=0, null=False, blank=False)
  25. year = models.IntegerField(default=0, null=False, blank=False)
  26. # fecha = models.CharField(max_length=150, null=False, blank=True)
  27. grade = models.CharField(max_length=3, default = 'N')
  28. salones =models.CharField(max_length=100,blank=True, null=True)
  29. horarios =models.CharField(max_length=150,blank=True, null=True)
  30. dias =models.CharField(max_length=100,blank=True, null=True)
  31. class ProximoSemestre(models.Model):
  32. course_id = models.ForeignKey(Curso, on_delete=models.CASCADE, default=1)
  33. name = models.CharField(max_length=150)
  34. code = models.CharField(max_length=15)
  35. creditos = models.IntegerField(default=0)
  36. section = models.CharField(max_length=5, null=True, blank=True)
  37. prof = models.CharField(max_length=150, null=True, blank=True)
  38. hours =models.CharField(max_length=150,blank=True, null=True)
  39. days =models.CharField(max_length=100,blank=True, null=True)
  40. rooms =models.CharField(max_length=100,blank=True, null=True)