You can override the admin's get_readonly_fields
method:
class MyModelAdmin(admin.ModelAdmin):
def get_readonly_fields(self, request, obj=None):
if obj: # editing an existing object
return self.readonly_fields + ('field1', 'field2')
return self.readonly_fields
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…