Inline.

"Simon Willison" <[EMAIL PROTECTED]> wrote 
in message news:[EMAIL PROTECTED]
>
>
> On 6 Dec 2005, at 21:00, Adrian Holovaty wrote:
>
>> Thoughts?
>>
>> http://code.djangoproject.com/wiki/RemovingTheMagic
>
> I really like almost all of it. My one hang-up is this:
>
> Person.objects.get_list(Person.q.first_name == 'Adrian')
>
> I like the Person.objects bit, but I'm not so keen on 
>  Person.q.first_name - it's pretty verbose.

Exactly my feelings after reading the document. I liked almost everything 
but was snagged a little but by Person.q.

> How about supporting an SQL where clause, as seen in Rails?
>
> Person.objects.get_where('first_name = %s and last_name = %s',  'Adrian', 
> 'Holovaty')
>
> Escaping would have to be handled in a backend dependant way, but  this 
> would solve a lot of our ugly syntax problems. We could keep the  old 
> method around for cases where database independent SQL generation  is 
> needed.

It looks like a good addition. Obviously it can be abused beyond debugging 
;-), but in simple cases (e.g., logical expressions) it is simple and 
expressive.

Thanks,

Eugene



Reply via email to