#17813: Implement an opposite method for Entry.objects.latest
-------------------------------------+-------------------------------------
     Reporter:  tonnzor              |                    Owner:  Fandekasp
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  SVN
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  1                    |
-------------------------------------+-------------------------------------

Comment (by hcarvalhoalves):

 Replying to [comment:8 Fandekasp]:
 > For the attributes, what is odd is to add a Meta.get_latest_by in your
 model when you want to call a earliest(), don't you think ?

 I don't think so. What I '''would''' consider odd, though, is having a
 second, analagous property, `get_earliest_by`, when you can just derive
 one from the other and stay DRY. As long as `ealiest()` is explained in
 the docs as doing the opposite of `latest()`, there's no more room for
 confusion.

 > It's also more flexible to have 2 separate attributes, therefore I
 finally think it's the best approach.

 I'm afraid this is a case were developers expect behaviour to be more
 obvious than flexible. Allowing `latest()` and `earliest()` to return
 different results is guaranteed to be a source of stupid bugs, while
 having no valid use case.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17813#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to