Slide 14
Slide 14 text
class Employee(models.Model):
name = models.CharField(max_length=128)
ROLE_CHOICES = (
('PIZZA', 'pizza delivery boy'),
('PILOT', 'spaceship pilot'),
('BENDING', 'bending unit'),
('DOCTOR', 'doctor'),
)
role = models.CharField(max_length=16,
choices=ROLE_CHOICES)
def __str__(self):
return self.name
Models
Sample field types:
ForeignKey, FileField,
DateField, SlugField,
ManyToManyField, etc.
Sample field options:
default, choices, unique,
help_text, editable, etc.