Hi,
I am using a form_as_model with newforms and when I do a save I get
the following error message on the form:
format is %Y-%m-%d %H:%M:%S.
This occurs with the event_date field.
Can you someone point me in the right direction to help me resolve
this issue.
Here are snippets of my models and views
models.py
# Events
class Events(models.Model):
city_name = models.ForeignKey(Cities)
event_name = models.CharField(maxlength=250)
event_details = models.TextField()
event_date = models.DateTimeField()
contact_name = models.CharField(maxlength=100, null=True,
blank=True)
contact_phone = models.PhoneNumberField(null=True, blank=True)
contact_url = models.CharField(maxlength=100, null=True,
blank=True)
location = models.CharField(maxlength=100, null=True, blank=True)
address = models.CharField(maxlength=255, null=True, blank=True)
city = models.CharField(maxlength=100, null=True, blank=True)
state = models.ForeignKey(States, null=True, blank=True)
zip = models.CharField(maxlength=12, null=True, blank=True)
owner = models.ForeignKey(User,related_name="owner",blank=True,
editable=False)
views.py
AddEventFormClass = forms.form_for_model(Events)
if request.method == 'POST':
# If data was POSTed, we're trying to create a new Event.
form = AddEventFormClass(request.POST)
# Check for errors.
print 'errors is ', form.errors
if form.is_valid():
form.save()
return HttpResponseRedirect("/tct/events/%s/" % city_id)
The errors occur before the form.is_valid check
Thanks,
Jeff
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---