-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a bug related to django4 foreign key lookups #647
base: master
Are you sure you want to change the base?
Conversation
Previous versions of django ran a foreign key lookup with a const (1) parameter in the column list. Django 4 changed that to a parameterized value and pass the parameter value 1. I have created a new token type to hold the aliased paramaterized value. SQLConstParameterizedIdentifier is subclassed from SQLConstIdentifier, and the original functionality is broken out into SQLConstIntIdentifier. This should allow anything that was using isinstanceof for SQLConstIdentifier to still work and allows expansion to other non-int constants. A test case has been added for the django 4 select statement.
Issue #630 was closed by the poster with the comment that they "fixed" it by reverting back to a prior django version. Other postings I've seen indicate that djongo is supposed to support the latest django version, so that issue should really still be open, and would be fixed by this pr. As far as I can tell, this is an issue with every foreign key relationship in the latest django due to changes in the sql it generates. |
@HardlyForeal Thanks! I had faced the same bug and used your commit files to update my local djongo files. Works like a charm now. |
Im facing exactly the same issue, @ghpkishore would you please share how did you manage to get it working? Did you use a monkey-patching in those methods? |
What ever files are present in this commit, I updated the files in my system with those. That worked. You can think of it as monkey-patching, but I changed the source code in the downloaded repo itself. |
Is this going to be merged soon? |
Will it get merge anytime soon? |
Still working perfectly in Django 4.2.3 and the latest uploaded version of djongo. I had the exists() issue and also the validation of duplicate User usernames in the DB wasn't working. Thank you so much! |
Thank you very much ! Please merge this fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge @doableware
@nesdis please can you take a look on this? |
Previous versions of django ran a foreign key lookup with a const (1) parameter in the column list. Django 4 changed that to a parameterized value and pass the parameter value 1. I have created a new token type to hold the aliased paramaterized value. SQLConstParameterizedIdentifier is subclassed from SQLConstIdentifier, and the original functionality is broken out into SQLConstIntIdentifier. This should allow anything that was using isinstanceof for SQLConstIdentifier to still work and allows expansion to other non-int constants.
A test case has been added for the django 4 select statement.
Closes #630
Closes #634