Skip to content
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

manager.py should not use hardcoded 'id' #16

Closed
marcofalcioni opened this issue Sep 25, 2019 · 2 comments
Closed

manager.py should not use hardcoded 'id' #16

marcofalcioni opened this issue Sep 25, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@marcofalcioni
Copy link
Contributor

line 42 and 172 should use 'pk' instead of 'id' I think. I am trying to verify this. I'll post updates when I do.

@M1ha-Shvn M1ha-Shvn added the bug Something isn't working label Sep 26, 2019
@M1ha-Shvn
Copy link
Owner

M1ha-Shvn commented Sep 26, 2019

Hi, thanks for reporting.
I suppose, you are right, but it's a little bit more complex. ReturningQuerySet gets data with native database column names. Its values_list method is not django one, it doesn't know, what field is a primary key. So what can be done is:

  1. Fetching pk name from django model in manager.py and getting it instead of id
  2. Resolving column names like pk inside ReturningQuerySet based on it's model and replacing id to pk in manager.py.

To my mind second way is more pretty.

I'm sorry, but I have no time for fixing it this week. I'll have a look in 2-3 weeks. If you want it faster - please, make a PR and I'll accept it.

M1ha-Shvn pushed a commit that referenced this issue Sep 30, 2019
Fixing [issue of using non-id primary key](#16) by [Marco Falcioni](https://github.com/marcofalcioni)
@M1ha-Shvn
Copy link
Owner

Released 1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants