I don't get why I'm getting a validation error with my code. I thought
that all of the built in fields are referenced inside of "from
django.db import models". Thanks for any help that you may offer.
ERROR
NameError: name 'DateTimeField' is not defined
CODE
#shifts.models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Shift(models.Model):
SHIFT_OPTIONS = (
('Shift A', 'Shift A'),
('Shift B', 'Shift B'),
('Shift C', 'Shift C'),
('Shift D', 'Shift D'),
)
name = models.CharField(max_length=7, choices=SHIFT_OPTIONS,
verbose_name='Shift Name')
date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()
class Schedule(models.Model):
# Shift
shift = models.ForeignKey(Shift, unique=True)
# User
user = models.ForeignKey(User, unique=True)
# Other
STATUS_OPTIONS = (
('Pending', 'Pending'),
('Approved', 'Approved'),
('Denied', 'Denied'),
)
status = models.CharField(max_length=7, choices=STATUS_OPTIONS)
submit_date = DateTimeField(auto_now_add=True)
change_date = DateTimeField(auto_now=True)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.