Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-03-08 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (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 Mariusz Felisiak ):

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

Comment:

 In [changeset:"73df8b54a2fab53bec4c7573cda5ad8c869c2fd8" 73df8b54]:
 {{{#!CommitTicketReference repository=""
 revision="73df8b54a2fab53bec4c7573cda5ad8c869c2fd8"
 Fixed #35044 -- Avoided clearing reverse relations and private fields when
 accessing deferred fields.

 Regression in a7b5ad8b19a08d7d57302ece74f6e26d2887fd9f for reverse
 relations and possibly in 123b1d3fcf79f091573c40be6da7113a6ef35b62 for
 private fields.
 }}}
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e1dd3935b-47fbf618-868f-462b-8743-dab8737de0fe-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-03-08 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (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
-+-
Comment (by Mariusz Felisiak ):

 In [changeset:"0c690c60012e6a2f0cde0fc564c55054c465d02f" 0c690c6]:
 {{{#!CommitTicketReference repository=""
 revision="0c690c60012e6a2f0cde0fc564c55054c465d02f"
 Refs #35044 -- Added Model.refresh_from_db(fields=...) test for clearing
 reverse relations.
 }}}
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e1dd392d4-eb803875-3f85-4b73-b8c8-5b65f7bf4fc6-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-03-08 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (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 Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e1d7b41cf-b777f2ee-2528-44fe-a4d6-2933d32bb52f-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-02-06 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (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 Giannis Terzopoulos):

 * has_patch:  0 => 1

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d7ffd5939-6357bf36-3684-46c9-9ca8-80acbf1fc609-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-02-06 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Giannis Terzopoulos):

 Thank you both! I opened a PR for this
 [https://github.com/django/django/pull/17831 PR]

 I've added tests for `defer()` and `only()` for relations/private fields
 and updated the `refresh_from_db()` accordingly. I also added a couple of
 tests with the `fields` kwarg specified.
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d7ff7e3cd-a1669f37-5b4d-4842-a096-5203c63f0a48-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-02-05 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Adam Johnson):

 Giannis, feel free to take this ticket. It’s now looking like my approach
 to #28586 will go in a different direction.
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d7b4be561-11545a5f-2b8d-4607-9e7b-9694fe50ee5f-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-02-04 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Simon Charette):

 > Not sure how I would deal with the private fields though to be honest,
 or if we actually need to handle that.

 yeah not sure either, I suggest trying the same approach that avoids
 clearing if `fields` is specified and the private field name is not part
 of them. My only concern is that I'm not sure how `.only` will behave when
 passed private field names. In all cases the only regression test existing
 for #34137
 
[https://github.com/django/django/commit/123b1d3fcf79f091573c40be6da7113a6ef35b62
 #diff-0e842fa4e4a689b120379780e62dc71a1476a409e21ccd09eac181ec5a2314d8R50
 doesn't make use] of `fields` so it's in a grey area.
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d760e4dea-4f40e66b-f100-4063-9093-911121eb7e56-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2024-02-04 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  Giannis
 |  Terzopoulos
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Giannis Terzopoulos):

 * owner:  nobody => Giannis Terzopoulos

Comment:

 Hey, I'm interested in taking this over unless @Adam, you might want to
 fix this as part of #28586?
 > Spotted whilst working on #28586. My implementation for that will
 probably fix this issue

 What I'm thinking to do is follow Simon's plan above and not clear cached
 relations when `refresh_from_db(fields)` is specified, unless a relation
 is part of `fields` explicitly.  Not sure how I would deal with the
 private fields though to be honest, or if we actually need to handle that.
-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d75a8e889-a8abaf97-b3f7-440f-a508-84e41315d6b1-00%40eu-central-1.amazonses.com.


Re: [Django] #35044: Accessing a deferred field clears reverse relations

2023-12-16 Thread Django
#35044: Accessing a deferred field clears reverse relations
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * type:  Cleanup/optimization => Bug
 * stage:  Unreviewed => Accepted


Comment:

 Feels like a bug to me.

 When `refresh_from_db(fields)` is specified it should likely not clear
 reverse relationships and I think the same can be said about

 Regression in a7b5ad8b19a08d7d57302ece74f6e26d2887fd9f #27846 for reverse
 relations and possibly 123b1d3fcf79f091573c40be6da7113a6ef35b62 #34137 for
 private fields. The private field situation is more complex though as they
 might be composed of other fields (e.g. `GenericForeignKey`) but the field
 APIs doesn't expose a generic way of introspecting that so I would assume
 we'd still want to clear .

 An alternative here would be to accept another kwarg to denote field cache
 clearing that would default to `True` and that `DeferredAttribute.__get__`
 would pass `False` to.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c73b93d0f-6b95e634-1536-4e39-a121-329ef4dc0f93-00%40eu-central-1.amazonses.com.