Skip to content

Instantly share code, notes, and snippets.

@xprilion
Created February 25, 2023 15:12
Show Gist options
  • Save xprilion/78040a9631b0902ca059760c42fe506e to your computer and use it in GitHub Desktop.
Save xprilion/78040a9631b0902ca059760c42fe506e to your computer and use it in GitHub Desktop.
from django.contrib import admin
from .models import ModelName
class CustomModelAdmin(admin.ModelAdmin):
def __init__(self, model, admin_site):
self.list_display = [field.name for field in model._meta.fields]
super(CustomModelAdmin, self).__init__(model, admin_site)
class ModelAdmin(CustomModelAdmin):
pass
admin.site.register(ModelName, ModelAdmin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment