django icon indicating copy to clipboard operation
django copied to clipboard

Fixed #33651 -- Added custom queryset support to generic foreign key

Open ab-revanthgss opened this issue 2 years ago • 12 comments

Modified the prefetch queryset function in generic foreign key field to support custom queryset of different content types.

ab-revanthgss avatar Apr 27 '22 07:04 ab-revanthgss

Hello @ab-revanthgss! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

github-actions[bot] avatar Apr 27 '22 07:04 github-actions[bot]

@felixxm Thanks for the review👍. I will look into the changes you suggested and update the PR

revanthgss avatar Apr 28 '22 05:04 revanthgss

@felixxm Any update on this one?

ab-revanthgss avatar May 05 '22 06:05 ab-revanthgss

@felixxm Can you review this PR and let me know if there are any changes required?

Thanks!!

ab-revanthgss avatar May 20 '22 06:05 ab-revanthgss

@David-Wobrock @carltongibson Tagging you to review this code as this PR is inactive since long time.

ab-revanthgss avatar Jun 09 '22 07:06 ab-revanthgss

Hi @ab-revanthgss — yes, thanks. This PR is on the review queue — patience is required I'm afraid. (We recently had the 4.1a1 release, which takes a lot of bandwidth in the run up to it.)

carltongibson avatar Jun 09 '22 07:06 carltongibson

@carltongibson Cool, no issues👍🏻. I just wanted to know this info.

Thanks

ab-revanthgss avatar Jun 09 '22 07:06 ab-revanthgss

@ab-revanthgss Do you have time to keep working on this?

felixxm avatar Aug 05 '22 06:08 felixxm

@ab-revanthgss Do you have time to keep working on this?

Hi @felixxm , Sorry for the delay. I am busy with some other work.

I tried looking into changing queryset argument to querysets. I think one good solution is to have a GenericPrefetch class that subclasses from Prefetch class to support querysets. To make this change, I need to dig deep on how the Prefetch works which is taking time.

Do you have any suggestions on how the querysets argument can be added or do you have some docs on Prefetch internals?

I will try to push the changes this week. In any case, I will revert back to you.

Thanks.

ab-revanthgss avatar Aug 08 '22 18:08 ab-revanthgss

I tried looking into changing queryset argument to querysets. I think one good solution is to have a GenericPrefetch class that subclasses from Prefetch class to support querysets. To make this change, I need to dig deep on how the Prefetch works which is taking time.

Yes, it's better idea than changing the current implementation of Prefetch. It's exactly what Simon suggested.

felixxm avatar Aug 16 '22 08:08 felixxm

Hi @felixxm ,

I have added the GenericPrefetch class. Thanks @charettes for suggesting the idea.

Thanks.

ab-revanthgss avatar Aug 18 '22 17:08 ab-revanthgss

Please take a look on failing tests.

felixxm avatar Aug 19 '22 04:08 felixxm

Closing due to inactivity.

felixxm avatar Feb 27 '23 09:02 felixxm

Hello @felixxm @charettes

I am also interested in this feature and would like to offer my help to finish this pull request.

As I understand, the remaining comments ask to:

  • move the documentation to django.contrib.contenttypes
  • move GenericPrefetch to django.contrib.contenttypes
  • deprecate get_prefetch_queryset and replace it with get_prefetch_querysets

Am I missing something?

Cheers

PS : thank you @ab-revanthgss for the initial work, I don't want to take credit for it so if you want to finish this, no worries. Otherwise, I am happy to do it

clement-escolano avatar Jul 27 '23 19:07 clement-escolano

Fab that you are interested in picking this up. 🎁

Your comments seem like reasonable next steps from my reading of the PR.

I'd encourage you to claim the ticket on trac and open a fresh PR when ready for another round of review.

I don't want to take credit for it so if you want to finish this.

We can add multiple authors to recognise contributions from multiple authors.

https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors

smithdc1 avatar Jul 27 '23 19:07 smithdc1

Hi @clement-escolano,

Thanks for picking this up. I initially picked this issue as I felt it's a small change of adding an argument to the existing functionality. But, given that we are thinking of deprecating get_prefetch_queryset(), it's a huge change for me to make as I am contributing for the first time and I am not aware of process of deprecating a feature in Django. Given that I have less time to work on this issue and the complexity of the issue, I feel it will be a faster fix if you work on this.

I am up for taking time and making changes to the PR incase you need any help.

Thanks, Revanth

ab-revanthgss avatar Jul 28 '23 09:07 ab-revanthgss

@smithdc1 Thank you. I will do this, I will start a new PR on Monday then.

@ab-revanthgss No worries, I understand. Thank you again for the initial work, I will try to complete it and I will reach out if I need help.

clement-escolano avatar Jul 28 '23 11:07 clement-escolano

Hello @smithdc1 I created the pull request here: https://github.com/django/django/pull/17136 It has been several weeks and I had no feedback (except a minor thing from a contributor). Is there something I should do so that the core team is aware of the pull request? I don't want to rush things, I just want to know if I should do something in order for the pull request to be merged or just wait for the core team. Cheers

clement-escolano avatar Aug 21 '23 13:08 clement-escolano