On Tue, Oct 21, 2008 at 12:30 AM, Josiah <[EMAIL PROTECTED]>wrote:

>
> Ive set up a simple model for a Cruise. It has a cruise date, and
> time. Im trying to pass a datetime.date as the date parameter which is
> defined in the model as models.DateField(). I get the following error
> constantly, and cant figure out what it wants me to do.
>
> im using sqlite as the temporary local dev database and mysql in
> production
>
> Thanks in advance
>
> Josiah
>
> -- error:
>
> int() argument must be a string or a number, not 'datetime.date'
>
>
> -- models.py
>        class Cruise(models.Model):
>            date    = models.DateField(verbose_name='Date')
>            am_time = models.TimeField(verbose_name='AM cruise time',
> blank=True, null=True)
>            pm_time = models.TimeField(verbose_name='PM cruise time',
> blank=True, null=True)
>
>
> -- views.py
>        # set up one cruise
>        cruise = Cruise(start_date, '1:30', '3:30') #start_date is a
> datetime.date object
>        cruise.save()
>

try:

cruise = Cruise(date=cdate, am_time='1:30', pm_time='3:30')

When you leave out the keywords I believe your first positional argument
gets matched to the automatically-generated 'id' field, which isn't
expecting a datetime.date.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to