[Django]-Join two tables in django admin to get columns for display_list

3πŸ‘

βœ…

To display the required items on the list display page you can write your custom methods, as documented here.

For example, for your field named program_name you can have:

def program_name(self, obj):
    if obj.program:
        return obj.program.program_name

program_name.short_description = 'Program name'

and for another model field named parameter_name , you may have:

def parameter_name(self, obj):
    if obj.vparameter:
        return obj.vparameter.parameter_name

parameter_name.short_description = 'Parameter Name'

Hope it helps.

πŸ‘€not2acoder

Leave a comment