On Mon, Oct 20, 2008 at 12:08 PM, Robocop <[EMAIL PROTECTED]> wrote: > Is it possible to do something like this syntactically: > > year = '2008' > month = '09' > limit = '31' > for i in range(1,limit):
This previous line will fail. range() takes numbers, not strings. Change 'limit' to an int. > temp = Table.objects.filter(date = year'-'month'-'i) <----screwed I believe you're looking for the string formatting syntax, to wit: temp = Table.objects.filter( date="%s-%s-%s" % (year, month, i) ) Note that you can let 'year' and 'month' be integers now, as they will be converted to strings for you automatically. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com > up syntax > ...do something with temp > return > > I know that the syntax within the filter statement is wrong. Is it > even possible to do something like that? Any help is always > appreciated. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list