Skip to content

Check if related model has an integer as pk for ManyToMany fields.#64

Merged
jedie merged 1 commit intojedie:masterfrom
logaritmisk:master
Mar 31, 2016
Merged

Check if related model has an integer as pk for ManyToMany fields.#64
jedie merged 1 commit intojedie:masterfrom
logaritmisk:master

Conversation

@logaritmisk
Copy link
Copy Markdown
Contributor

I have a model (Station) that uses UUID as pk, and it has an ManyToMany relation to a model (Entity) that uses integers as pk. With current implementation I get an exception because Station.has_int_pk() returns False (as it should), so ids is None when we call get_many_to_something(). It should check if the related model has integers as pk, because it's the related model ids when want in our query.

I guess there should be an else statement where ids is set to self.value, if the related model uses string as pk?

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 78.648% when pulling d4b9b17 on logaritmisk:master into fe24dbc on jedie:master.

@jedie jedie merged commit 335dd4a into jedie:master Mar 31, 2016
@jedie
Copy link
Copy Markdown
Owner

jedie commented Mar 31, 2016

Thanks for contribution!

Can you also contribute a test with UUID?

@logaritmisk
Copy link
Copy Markdown
Contributor Author

I'm doing this for a client, so not much time over to other things. But I will give it a try and see if I can get something working after work

@jedie
Copy link
Copy Markdown
Owner

jedie commented Apr 27, 2016

i uploaded release v0.6.2 that contains this pull ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants