In order to register the instructor workshop model in admin page, you can open the event/admin.py
file and add the following code :
from .models import WorkshopInstructor
@admin.register(WorkshopInstructor)
class WorkshopInstructorAdmin(admin.ModelAdmin):
list_display = ('instructor_name', 'company_name', 'designation', 'workshop')
search_fields = ['instructor_name', 'company_name', 'designation', 'workshop__name']
list_filter = ['workshop']
Here readonly_fields is specified to workshop, this means once an instructor is assigned to a particular workshop, the workshop can't be changed through the admin page. This way, workshop and the workshop instructor details can be added and stored.