Код: Выделить всё
class Inspection(models.Model):
RESULT_CHOICES = [
("PR" "Passed"),
("PR" "Passed with minor Defects"),
("PR" "Passed with major Defects"),
("FR" "Failed due to minor Defects"),
("FR" "Failed due to major Defects"),
("FR" "Failed"),
]
vin_number = models.ForeignKey(Vin, on_delete=models.CASCADE, related_name='inspections')
inspection_number = models.CharField(max_length=20)
year = models.CharField(max_length=4)
inspection_result = models.CharField(max_length=30,
choices=RESULT_CHOICES)
ag_rating = models.CharField(max_length=30)
inspection_date = models.DateField()
link_to_results = models.CharField(max_length=200)
def __str__(self):
return self.inspection_number
Код: Выделить всё
YEAR_IN_SCHOOL_CHOICES = {
"FR": "Freshman",
"SO": "Sophomore",
"JR": "Junior",
"SR": "Senior",
"GR": "Graduate",
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... human-read