Hi Selwin,
On Saturday 11 May 2013, Selwin Ong wrote:
> Hi everyone,
>
> I submitted a pull request implementing "first()" and "last()" here:
> https://github.com/django/django/pull/1054
>
> Comments welcome!
>
You implemented the "order_by" parameter as taking only one field name; this is
inconsistent with the way ordering is done elsewhere -- both the queryset
order_by() method, and the model meta ordering option, take a list of field
names, each optionally prefixed by "-".
While I can see reason in going for a simpler implementation, I think it is
much preferable to have a consistent API; and even if the simpler
implementation is preferred, you should take care of a more friendly error
message for someone who would call qset.first("a","b") or even qset.last("-a")
[the latter may seem to make no sense -- "if that's what you want, call
qset.first('a')" -- but may reasonably arise in situations where the ordering
field is received as an argument].
Shai.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.