Re: [Django] #25279: Make prefetch_related_objects a public API

2016-02-26 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"ef33bc2d4d5e66b08cba2a318aa700ba1e28ba81" ef33bc2]:
 {{{
 #!CommitTicketReference repository=""
 revision="ef33bc2d4d5e66b08cba2a318aa700ba1e28ba81"
 Fixed #25279 -- Made prefetch_related_objects() public.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.92fbd3f1446630635929c49c5c3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-09-25 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * stage:  Accepted => Ready for checkin


Comment:

 Pending Loic's review.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.144ab96e27a7cb2d1b3091412580f79b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-09-21 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * keywords:  1.9 =>


Comment:

 Loic's concerns are, "I have nothing against exposing that functionality
 itself, I just wanted to review if it works as-is as an elegant and
 reliable public API, right now it's a utility function it wasn't designed
 with those concerns in mind."

 Since it's mostly a documentation patch at this point, it doesn't seem
 critical for 1.9.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5b06e732b2012955736118833b28e87b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-09-07 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  1.9  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * keywords:   => 1.9


Comment:

 Loic had some doubts about making `prefetch_related_objects()` a public
 API. So, I'm awaiting his feedback here or on the mailing list before
 proceeding with this ticket.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.0ebb73a7761e0db34f729987ff421217%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-09-05 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by timgraham:

Old description:

> `prefetch_related` is great, but it would be nice to be able to reuse its
> capabilities with lists of model instances already retrieved by other
> code (or from cache, or newly constructed, etc.). It seems this is
> possible by using `django.db.models.query.prefetch_related_objects` which
> is the function implementing all the prefetch capability - I've just seen
> it used fine, however it is not part of Django's public API.
>
> As far as I can tell, just doing an `import` in
> `django.db.models.__init__` and adding documentation should be enough to
> make it public, since `prefetch_related_objects` contains all the
> functionality that `prefetch_related` exposes.

New description:

 `prefetch_related` is great, but it would be nice to be able to reuse its
 capabilities with lists of model instances already retrieved by other code
 (or from cache, or newly constructed, etc.). It seems this is possible by
 using `django.db.models.query.prefetch_related_objects` which is the
 function implementing all the prefetch capability - I've just seen it used
 fine, however it is not part of Django's public API.

 As far as I can tell, just doing an `import` in
 `django.db.models.__init__` and adding documentation should be enough to
 make it public, since `prefetch_related_objects` contains all the
 functionality that `prefetch_related` exposes.

 [https://groups.google.com/d/topic/django-
 developers/xjxKnhEDl7s/discussion django-developers discussion]

--

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.ac09017796728831e0b3748dc60786aa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-08-28 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_tests:  1 => 0


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.7e379886f1c66fa17b2f8f0e4bf30960%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-08-21 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by adamchainz):

 I've added some tests for the basics (one-to-one/many-to-many traversal
 plus `Prefetch` objects) but don't want to go too far basically
 duplicating the tests that already exist for `prefetch_related`. The aim
 is just to check it accepts the same arguments and thought is put in to
 changing it in the future.

 I've also changed the function signature to
 `prefetch_related_objects(list_of_objects, *lookups)` for the simpler
 invocation `prefetch_related_objects(objs, 'lookup1', 'lookup2__and3')`,
 as opposed to `prefetch_related_objects(objs, ['lookup1',
 'lookup2__and3'])`. This is to defend against the possible bug from
 `prefetch_related_objects(objs, 'lookup1')` which would iterate the
 characters in `lookup1` leading to errors about attribute `l` etc. not
 existing.

 I'm guessing that although some existing projects may already be using
 `prefetch_related_objects`, it's not Django's policy to worry about
 changing the signature of a (previously) private function? Or should I add
 type-checking like `if len(args) == 1 and isinstance(args[0], (tuple,
 list))` to allow the old style?

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.faedc83aae1aeb5d951f06419f0f8daf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-08-19 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_tests:  0 => 1
 * stage:  Unreviewed => Accepted


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.476fbdc62ef0394d56c8ff96ef56e49d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-08-15 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by adamchainz):

 * has_patch:  0 => 1


Comment:

 Oh #24975 is nice. It doesn't seem that hard to do - on Model would it not
 just require...

 {{{
 def prefetch_related(self, related_lookups):
 prefetch_related_objects([self], related_lookups)
 }}}

 Basic PR at [https://github.com/django/django/pull/5138], with a
 documentation sketch. Agree that more tests would be required.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.2e40f2c4f679409898ace606d0bd1d18%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25279: Make prefetch_related_objects a public API

2015-08-15 Thread Django
#25279: Make prefetch_related_objects a public API
-+-
 Reporter:  adamchainz   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  1.8
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Seems related to #24975 which proposes to add the ability to call
 `prefetch_related()` on a model instance. I wonder if we could find a
 common solution to address both of these tickets.

 If we make `prefetch_related_objects()` public, I think some tests would
 also be needed to ensure that it isn't refactored so that it's signature
 changes.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.aac31ea0c930c5f088ff77a18e00%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.