Hide Admin panel drop down

I have created a Django project with two tables: factors and version_composition. In the version_composition table, factor is used as a foreign key. I have used the tabular method to create an admin panel for factor and included it in version_composition. This creates a dropdown, but I want to hide this dropdown. Is there any method or example to achieve this?

Welcome @mohit2305 !

I understand that English is probably not your primary language, but I think you’re going to need to try rewording your question for us to be able to help you.

If you’re more comfortable writing in your native language, you can try writing your post in that language, and then using something like Google translate to convert it to English.

Hello sir,

@KenWhitesell, please read it.

Thank you

I’m still not sure I’m understanding what you’re looking for.

If you don’t want to see the factor field in version_composition, then don’t include that field in the model’s fields attribute in the ModelAdmin class.

But, what you wrote leads me to believe you’re using a TabularInline to show these instances, I’m not understanding why you’re doing this and then not wanting to show it.

Hello @KenWhitesell

We want to ensure that the data already stored in the factor table should not be selectable, but the ‘Add’ option should still appear. In the tabular method, the data we add should automatically be selected in version_composition.

If what you’re looking to do is to not display existing entries, then you could create a custom get_queryset() method on your inline to not return any entries.

At this point, to provide any further assistance, I think I’m going to need to see these models and their model admin classes.

@KenWhitesell In this image, the dropdown data comes from the factor table, but we want to hide this dropdown. However, we want the ‘Add’ and ‘Edit’ options to work as it.