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.
+1 on the proposal but for the bit you mentioned. My head is turning inside out trying to make sense of Person.objects.get_list(Person.q.first_name == 'Adrian'): Person.q.first_name == 'Adrian' is an _expression_ and should return True or False, so I am thinking == is a typo and you meant =, in which case you are trying to use keyword argumet, but how? What is type( Perso.q.first_name)?
>>> def f(a):
... print a
...
>>> k = 'a'
>>> f(k=10)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: f() got an unexpected keyword argument 'k'
How about supporting an SQL where clause, as seen in Rails?
Person.objects.get_where('first_name = %s and last_name = %s',
'Adrian', 'Holovaty')
--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701