Created
February 25, 2023 15:12
-
-
Save xprilion/78040a9631b0902ca059760c42fe506e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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