On 11/29/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> add leaving out '()' in a function without arguments and you are done
Nah, I don't do enough Ruby to get into that habit. Besides, my free
time these days (free time! Ha!) is mostly spent playing with Lisp
(and a little OCaml), which mea
On 30-Nov-06, at 1:04 AM, James Bennett wrote:
> I leave off * and ** by accident all the time. That and commas in
> single-element tuples are probably 90% of the stupid Python mistakes I
> make.
add leaving out '()' in a function without arguments and you are done
--
regards
kg
http://lawgo
On 11/29/06, Bill de hOra <[EMAIL PROTECTED]> wrote:
> I was passing it in without the **; arrhhh
:)
I leave off * and ** by accident all the time. That and commas in
single-element tuples are probably 90% of the stupid Python mistakes I
make.
--
"May the forces of evil become confuse
James Bennett wrote:
> Doing NodeEvent.objects.filter(**kwargs) should work
^^
I was passing it in without the **; arrhhh
anyway this the idiom I ended up with for a different model:
[[[
if request.has_key('q'): # GET form
new_data = reques
I don't know if this helps, or is exactly what your trying to avoid,
but I've done something like this before (based on your example):
if use_sources:
qSource = Q(source_time__range=(start_date, end_date))
else:
qSource = Q(id__gt=0)
if use_level:
qLevel = Q(level__exact=level)
else:
On 11/29/06, Bill de hOra <[EMAIL PROTECTED]> wrote:
> something like this:
>
> [[[
> if use_sources:
>kwargs['sources']= request.GET.getlist('sources')
> if use_level:
>kwargs['level'] =request.GET['level']
> ...
> results = NodeEvent.objects.filter(kwargs)
> ]]]
Doing NodeEvent.objects
Hi,
Suppose you have 2 fields in a query form, both of which are optional.
Is there an idiom for building a dictionary to pass into
objects.filter() instead of checking the permutations?
eg instead of crazy stuff like this:
[[[
if use_sources and use_level:
results = NodeEvent.object
7 matches
Mail list logo