code: def handle_class_prepared(sender, **kwargs):
      
      from .settings import M2M_REGISTRY, FK_REGISTRY
      from .registration import registry
      sender_app = sender._meta.app_label
      sender_name = sender._meta.model_name
  
      for key, val in list(FK_REGISTRY.items()):
          app_name, model_name = key.split('.')
          if app_name == sender_app and sender_name == model_name:
              registry.register_model(app_name, sender, 'ForeignKey', val)
  
      for key, val in list(M2M_REGISTRY.items()):
          app_name, model_name = key.split('.')
          if app_name == sender_app and sender_name == model_name:
              registry.register_model(app_name, sender, 'ManyToManyField', val)
docs: See if this class needs registering of fields