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
class DisableMigrations(object): | |
def __contains__(self, item): | |
return True | |
def __getitem__(self, item): | |
return "notmigrations" | |
MIGRATION_MODULES = DisableMigrations() |
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
class CommonAdmin(admin.ModelAdmin): | |
ordering = ['id'] | |
def __init__(self, *args, **kwargs): | |
super(CommonAdmin, self).__init__(*args, **kwargs) | |
self.set_list_display(args[0]) # set fields to display --> all of them | |
def set_list_display(self, model): | |
fields = [] | |
for field in model._meta.fields: |