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

References on Admin Page #147

Closed
rmad1717 opened this issue Apr 16, 2020 · 4 comments
Closed

References on Admin Page #147

rmad1717 opened this issue Apr 16, 2020 · 4 comments

Comments

@rmad1717
Copy link

rmad1717 commented Apr 16, 2020

Is it possible to get references as a dropdown in Torch Admin page, like Django Admin?

@cpjolicoeur
Copy link
Member

I'm not familiar with Django Admin. Could you give me an example or screenshot of what you are looking for?

Or at least describe now what/where you'd like to see a change vs what Torch currently does?

@rmad1717
Copy link
Author

Lets say I have two tables called cities and countries. cities has a foreign key to country. When I open page of a city it should show a list of names or ids of countries(it would be great if we have the ability to define which field value of country should appear in dropdown) in the the foreign key field for country.
image

@rmad1717
Copy link
Author

Is it possible to have this in torch?

@cpjolicoeur
Copy link
Member

Sure. You could format the views anyway you like with Torch.

Don't forget that Torch is just a generator. Your admin views are generated once, but the expectation is that you will edit and modify them to suit your needs, and alter the views as the shape of your models changes over time.

It's pretty simple today to modify a torch view and add the functionality you are describing on a per-case basis.

The initial generators could get a bit smarter though and handle FK reference inputs in this manner as well as an enhancement down the line.

If you want to take a try at it and submit a PR to get the ball rolling, that would be awesome!

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

No branches or pull requests

2 participants