I am trying to create read only field for specific row where is values , and i wrote this script , with this script after saving the page i can not edit the empty rows ,in the page.
class Calender(admin.TabularInline):
model = models.Calendar
def get_readonly_fields(self, request, obj=None):
if obj:
return self.readonly_fields + ("registrations", "calendar")
return self.readonly_fields