> However, I keep getting validating errors with datetime, probably is > how I am entering the data. I have also tried the SplitDateTimeWidget > I am getting the same > validation error These are the valid input formats: http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.DateTimeField.input_formats
Check if they look like the sting you are feeding your form input with. If you still keep getting validation errors, it would be nice if you could attach the stack trace in a reply to this mail. Kenny On Mon, May 9, 2011 at 12:36 PM, Kevin Miller <kevinvani...@gmail.com> wrote: > Thanks so much for your response. I have done all that and I have > model forms working for other models. > However, I keep getting validating errors with datetime, probably is > how I am entering the data. I have also tried the SplitDateTimeWidget > I am getting the same > validation error. I have tried manually creating the form and it > worked. I wonder what is the normally approach to DateTimeField in > django templates. Is using the > SplitDateTimeWidget the norm or should I use the AdminDateTimeWidget ? > > Thanks again. > > > > On Mon, May 9, 2011 at 11:11 AM, Kenny Meyer <knny.m...@gmail.com> wrote: >> On Mon, May 9, 2011 at 10:55 AM, Kevin Miller <kevinvani...@gmail.com> wrote: >>> Dear all, >>> >>> I am new to django but is in the process of building my first website. I >>> have >>> been ok for a while as I am not new to programming in python. However, I >>> have >>> one problem that I cannot figure out the proper way to do it. I want to use >>> ModelForm but have a DateTime Field. I can do it without using a ModelForm >>> but >>> I think using the ModelForm is the proper way to do it. >> >> What's the problem with the DateTimeField in a model? >> >>> Can someone show me a small example of using ModelForm with DateTime field? >>> How can can the DateTime field me displayed in django templates? >> >> in your models.py: >> >> class Foo(models.Model): >> datetime = models.DateTimeField() >> >> class FooForm(forms.ModelForm): >> class Meta: >> model = Foo >> >> >> in your views.py: >> >> def bar(request): >> form = FooForm() >> return render_to_response("bar.html", {"form": form}) >> >> >> in template bar.html: >> >> {{ foo }} >> >> >> There's absolutely nothing special here :) . >> >> If you couldn't understand some of the code, then you should read the >> documentation . >> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> >> > > > > -- > Kevin Miller > Acting Data Controller > Department of Computing > UWI, Mona > Kingston 7 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.