Re: I think adding a "first" method to the QuerySet be useful.

2012-07-03 Thread Luke Plant
On 03/07/12 05:27, Maxime Haineault wrote: > One of the common pitfall I come across way to often with novices is > something like this: > > def getFirstUser(): > return User.objects.all()[0] > > It looks innocuous and often wont raise any exceptions in dev because > you develop and t

Re: I think adding a "first" method to the QuerySet be useful.

2012-07-03 Thread Daniel Sokolowski
@googlegroups.com Subject: I think adding a "first" method to the QuerySet be useful. One of the common pitfall I come across way to often with novices is something like this: def getFirstUser(): return User.objects.all()[0] It looks innocuous and often wont raise any exceptions in d

Re: I think adding a "first" method to the QuerySet be useful.

2012-07-03 Thread Chris Wilson
Hi all, On Tue, 3 Jul 2012, Łukasz Rekucki wrote: On 3 July 2012 06:27, Maxime Haineault wrote: One of the common pitfall I come across way to often with novices is something like this: def getFirstUser(): return User.objects.all()[0] It looks innocuous and often wont raise any e

Re: I think adding a "first" method to the QuerySet be useful.

2012-07-03 Thread Kiril Vladimirov
We shouldn't bloat the API. Obviously there are nice looking approaches and not to mention the different behaviour in some of them. -1 on this proposal from me. On Tuesday, July 3, 2012 8:22:59 AM UTC+3, Łukasz Rekucki wrote: > > On 3 July 2012 06:27, Maxime Haineault wrote: > > One of the co

Re: I think adding a "first" method to the QuerySet be useful.

2012-07-02 Thread Łukasz Rekucki
On 3 July 2012 06:27, Maxime Haineault wrote: > One of the common pitfall I come across way to often with novices is > something like this: > > def getFirstUser(): > return User.objects.all()[0] > > It looks innocuous and often wont raise any exceptions in dev because you > develop and

Re: I think adding a "first" method to the QuerySet be useful.

2012-07-02 Thread Alex Gaynor
On Mon, Jul 2, 2012 at 9:27 PM, Maxime Haineault wrote: > One of the common pitfall I come across way to often with novices is > something like this: > > def getFirstUser(): > return User.objects.all()[0] > > It looks innocuous and often wont raise any exceptions in dev because you > d

I think adding a "first" method to the QuerySet be useful.

2012-07-02 Thread Maxime Haineault
One of the common pitfall I come across way to often with novices is something like this: def getFirstUser(): return User.objects.all()[0] It looks innocuous and often wont raise any exceptions in dev because you develop and test with data, so they slip easily in production. de