Thanks, I'll give it a shot !

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von Oleg Lomaka
Gesendet: Mittwoch, 20. April 2011 11:24
An: django-users@googlegroups.com
Betreff: Re: queries gone wild

 

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.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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