Search code examples
djangodjango-formsdjango-templatesdjango-admindjango-contenttypes

How to get list of all fields corresponding to a model saved in content type framework in django


I have this requirement in which I have to show two dropdown fields on Django admin page. The first field will be the dropdown of all the table names available in my project, and the second field will be a dropdown all the available fields of the table selected in 1st dropdown. The second field will be dynamic based on the selection of the first dropdown. I am planning to handle this by overriding change_form_template.

Now, I can show the dropdown of table names by fetching them through content type Django model, But not able to fetch corresponding fields as content type model save the model name as a string. So is there any way not necessarily using Content-Type to achieve such a requirement?

Any help around that will be highly appreciated.

Thank you.


Solution

  • Here you have dependency of another fields right so i think you need to see i give link,then yo get error let me know

    link:hint of dependency field in django