Skip to content

Instantly share code, notes, and snippets.

@bluethon
Created November 3, 2016 06:44
Show Gist options
  • Select an option

  • Save bluethon/901f4e01115f30b2142b381bc8d08d36 to your computer and use it in GitHub Desktop.

Select an option

Save bluethon/901f4e01115f30b2142b381bc8d08d36 to your computer and use it in GitHub Desktop.

Revisions

  1. bluethon created this gist Nov 3, 2016.
    5 changes: 5 additions & 0 deletions django_admin_all_fields_readonly.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    class CustomAdmin(admin.ModelAdmin):
    def get_readonly_fields(self, request, obj=None):
    # ...

    return [f.name for f in self.model._meta.fields]