📌  相关文章
📜  管理员仅在创建时使字段可编辑 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:54.308000             🧑  作者: Mango

代码示例1
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 []