To not waste time and to avoid mistakes.
Testing models is easier through the graphic admin panel Django provides. The mundane thing is to register every models, and, more specifically, to set up list-display. To avoid wasting time, make a ModelAdmin like this:
from django.contrib import admin
class RelationshipAdmin(admin.ModelAdmin):
def get_list_display(self, request):
return [field.name for field in self.model._meta.concrete_fields]
And register all of your models in this fashion, if you are ok with having all fields in list_display:
from django.contrib import admin
from .models import *
@admin.register(WhiteModel)
@admin.register(BlueModel)
@admin.register(RedModel)
class RelationshipAdmin(admin.ModelAdmin):
def get_list_display(self, request):
return [field.name for field in self.model._meta.concrete_fields]
You well have your models registered with all fields – including pk
.