Oh i see.

Have a look at this widget

from django.forms.extras.widgets import SelectDateWidget
date = forms.DateField(widget=SelectDateWidget)

This will display Month, Day, and Year as separate selects. I would
probably subclass it to drop the Day field. Just automatically have it
set in the background to 1 or something.

On May 12, 9:05 am, zachp <zpice...@gmail.com> wrote:
> Yes, but the calendar widget isn't what I want. My user only really
> needs to pick a month (and maybe a year) but not a day. I could resort
> to using that field type, but I wanted to see if I could overcome this
> problem since, at least in my opinion, the calendar widget might be a
> little confusing.
>
> Thanks for the suggestion.
>
> On May 12, 7:56 am, Sean Brant <brant.s...@gmail.com> wrote:
>
> > 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
> > orhttp://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