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

multi column foreign key #188

Closed
eskhool opened this issue Dec 15, 2014 · 6 comments
Closed

multi column foreign key #188

eskhool opened this issue Dec 15, 2014 · 6 comments
Labels

Comments

@eskhool
Copy link

eskhool commented Dec 15, 2014

It should be pretty straightforward to have multiple column based Foreign Key lookup. I can easily make the change and submit a pull request. Any particular way we should take the multiple columns in the Foreign Key Widget in the Field in the Resource definition?

@manelclos
Copy link
Contributor

Hi @eskhool, what do you want to accomplish by having multiple fields in the Foreign Key? In Django itself this is not supported. How is this different to issue #189?

@eskhool
Copy link
Author

eskhool commented Jun 21, 2015

Idea is to lookup a FK using more than one field for example if I am loading data in Model A with a foreign key to Model B and I want to identify model B using multiple fields B.fielda and B.fieldb. Am I missing how to do this?

@manelclos
Copy link
Contributor

It looks to me this is something very specialised, you can always do it with a custom format.

@suriya
Copy link
Contributor

suriya commented Jul 21, 2015

I have a similar requirement as well. Until recently, I have been using my own CSV import code. However, I want to move to a library that is better supported and used by others. I came across django-import-export and I see that it does not support looking up ForeignKey objects with multiple lookup fields.

A classic example would be looking up a person by first_name and last_name fields. @manelclos suggestion of using a custom format works. We could have a name field and split its values and do a lookup. It is obvious that this could break based if the last_name has a space in it.

@int-ua
Copy link
Contributor

int-ua commented Dec 28, 2015

It could have been solved relatively easily if there was a way to access other row values from a Widget. Is there a feature request for this? I can't find it.

@stale
Copy link

stale bot commented Feb 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants