Answers for "admin make field editable only in create"

0

admin make field editable only in create

def get_readonly_fields(self, request, obj=None):
    if obj: # obj is not None, so this is an edit
        return ['third_party_id',] # Return a list or tuple of readonly fields' names
    else: # This is an addition
        return []
Posted by: Guest on June-16-2021

Code answers related to "admin make field editable only in create"

Browse Popular Code Answers by Language