Looks like you store dates as strings in sqlite and as dates in mysql. Try
this queryset:

Duchung.objeccts.filter(Mitarbeiter=request.user.id,
Datum__year=str(tag).split('-')[0])

On Wed, Apr 20, 2011 at 11:51 AM, Szabo, Patrick (LNG-VIE) <
patrick.sz...@lexisnexis.at> wrote:

>
>
> For developement i’ve used sqlite and now i want to transfer to mysql.
>
> The transfer itself worked fine but now a couple of queries don’t work
> anymore.
>
>
>
> Example:
>
>
>
> Buchung.objects.filter(Mitarbeiter = request.user.id,
> Datum__startswith=str(tag).split(*'-'*)[0])
>
>
>
> „tag“ looks like 2011-04-20.
>
> So I only want to get objects where „Datum“ (Date) starts with 2011.
> „Datum“ looks just like „tag“.
>
> This worked fine with sqlite but now Im getting this error:
>
>
>
> Incorrect date value: '2011%' for column 'Datum' at row 1
>
>
>
> Does anyone know how to overcome this ?!
>
>
>

-- 
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