Did you try date = models.DateTimeField(). This will show up in the
admin tool as a calendar widget that you can use to select the date.
Django takes care of converting the dates into Python objects and into
whatever format your database needs for storing. You could also just
use a DateField if you do not need the time.
http://docs.djangoproject.com/en/dev/ref/models/fields/#datetimefield
or http://docs.djangoproject.com/en/dev/ref/models/fields/#datefield

On May 12, 6:47 am, zachp <zpice...@gmail.com> wrote:
> Hi, I'm completely new to django, so please bear with me. My first
> project is a site which handles a monthly prize drawing for my
> company. People build up points throughout the month by carpooling/
> biking to work, etc, and at the end of the month a drawing is done to
> determine a winner. My question is with the form that will be used to
> run the contest. I need the user who does this to be able to select a
> month (and possibly a year) for the drawing she wants to run. I need
> django to convert those two data points into a datetime object for me,
> but it's not readily obvious how to do that. My first shot at it had a
> ChoiceField in the form which I populated with month names, but now
> I'm stuck on the best way to get those converted to datetime objects.
> Please help! Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to