On 9 loka, 20:15, ptone <pres...@ptone.com> wrote: > Unsurprisingly - this has come up before: > > Earlier > discussionhttps://groups.google.com/forum/?fromgroups=#!topic/django-developers... > > tickets:https://code.djangoproject.com/ticket/17546https://code.djangoproject.com/ticket/2659https://code.djangoproject.com/ticket/11352 > > All the ticket's were wontfixed
OK, it seems .get_or_none() method is out. I can see the point of that decision, there are a lot of similar methods that could be added using the convenience argument (like .first() in conjunction with .latest()). But, how about .get() with __default kwarg? No new method, and this is obviously Pythonic - see dict.get() and dict.pop(). The default argument for pop() is there only to avoid code like: try: val = somedict.pop('somekey') except KeyError: val = None The __default kwarg is easy to implement: https://github.com/akaariai/django/commit/3ea711544364723b26fcef83dc700f0b359655c9 On the other hand, this is still API bloat... So, I will not push this issue further without some support for this idea. It would maybe be time to investigate again the "chainable" manager methods. Having them available would solve a lot of the convenience method problems. And a lot of other problems, too... - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.