計劃把 文章全部轉移至 這裡,而本 Blogger 站台的文章近 500 篇,我預計在 2014-12-31 前移轉完畢,完成後 將只作代轉服務,一律把舊連結如 轉成 ,敬請舊雨新知互相走告。


何岳峰 敬上

2008年6月29日 星期日

problem with django: use __year or not && use subversion or not

when i put the new sources in the remote web server, and something happened!

the query result had nothing!! when i 'diff' the environment of server and mine, i got one thing difference. one is python 2.5.2 and the other is 2.5.1, but i have no idea about why!

the problem is 『__year』, i set a datetime field in a django model, and i can query it by year with suffix parameter __year like filter( and it's work for mine but not for remote server. so for the general case, i changed the code to two queries like below:

filter(, 1,1),, 12,31))

then i changed 5 files in my application. before svn commit, i use svn diff to see what i modified and found a error.

Can you see??

--- apps/supervise/ (revision 1256)
+++ apps/supervise/ (working copy)
@@ -145,7 +145,8 @@
if h.has_key('year') and h['year'] != '':
Y = Year.objects.get(id=h['year'])
- sc = sc.filter(
+ sc = sc.filter(, 1, 1),
+, 12, 31))

if i have no subversion, i will write a bug after a debug.

1 則留言:

  1. because i type wrong word:

    In this line:
    + sc = sc.filter(, 1, 1),

    i should use "date_gte", not date_get



Related Posts Plugin for WordPress, Blogger...