original_docstring: 
          A nasty hack that prevents a generated table model and related auto created
          models from being registered to the apps. When a model class is defined it
          will be registered to the apps, but we do not always want that to happen
          because models with the same class name can differ. They are also meant to be
          temporary. Removing the model from the cache does not work because if there
          are multiple requests at the same, it is not removed from the cache on time
          which could result in hard failures. It is also hard to extend the
          django.apps.registry.apps so this hack extends the original `register_model`
          method and it will only call the original `register_model` method if the
          model is not a generated table model.
  
          If anyone has a better way to prevent the models from being registered then I
          am happy to hear about it! :)
          
docstring: A nasty hack that prevents a generated table model and related auto created
  models from being registered to the apps. When a model class is defined it
  will be registered to the apps, but we do not always want that to happen
  because models with the same class name can differ. They are also meant to be
  temporary. Removing the model from the cache does not work because if there
  are multiple requests at the same, it is not removed from the cache on time
  which could result in hard failures. It is also hard to extend the
  django.apps.registry.apps so this hack extends the original `register_model`
  method and it will only call the original `register_model` method if the
  model is not a generated table model.
  
  If anyone has a better way to prevent the models from being registered then I
  am happy to hear about it.
docstring_tokens: A nasty hack that prevents a generated table model and related auto created models from being registered to the apps . When a model class is defined it will be registered to the apps but we do not always want that to happen because models with the same class name can differ . They are also meant to be temporary . Removing the model from the cache does not work because if there are multiple requests at the same it is not removed from the cache on time which could result in hard failures . It is also hard to extend the django . apps . registry . apps so this hack extends the original ` register_model ` method and it will only call the original ` register_model ` method if the model is not a generated table model . If anyone has a better way to prevent the models from being registered then I am happy to hear about it .
code: def prevent_generated_model_for_registering(self):
          """
          A nasty hack that prevents a generated table model and related auto created
          models from being registered to the apps. When a model class is defined it
          will be registered to the apps, but we do not always want that to happen
          because models with the same class name can differ. They are also meant to be
          temporary. Removing the model from the cache does not work because if there
          are multiple requests at the same, it is not removed from the cache on time
          which could result in hard failures. It is also hard to extend the
          django.apps.registry.apps so this hack extends the original `register_model`
          method and it will only call the original `register_model` method if the
          model is not a generated table model.
  
          If anyone has a better way to prevent the models from being registered then I
          am happy to hear about it! :)
          """
  
          original_register_model = self.apps.register_model
  
          def register_model(app_label, model):
              if not hasattr(model, "_generated_table_model") and not hasattr(
                  model._meta.auto_created, "_generated_table_model"
              ):
                  original_register_model(app_label, model)
              else:
                  # Trigger the pending operations because the original register_model
                  # method also triggers them. Not triggering them can cause a memory
                  # leak because everytime a table model is generated, it will register
                  # new pending operations.
                  self.apps.do_pending_operations(model)
                  self.apps.clear_cache()
  
          self.apps.register_model = register_model
code_tokens: def prevent_generated_model_for_registering ( self ) : original_register_model = self . apps . register_model def register_model ( app_label , model ) : if not hasattr ( model , "_generated_table_model" ) and not hasattr ( model . _meta . auto_created , "_generated_table_model" ) : original_register_model ( app_label , model ) else : self . apps . do_pending_operations ( model ) self . apps . clear_cache ( ) self . apps . register_model = register_model
short_docstring: A nasty hack that prevents a generated table model and related auto created
  models from being registered to the apps.
short_docstring_tokens: A nasty hack that prevents a generated table model and related auto created models from being registered to the apps .
comment: """
          A nasty hack that prevents a generated table model and related auto created
          models from being registered to the apps. When a model class is defined it
          will be registered to the apps, but we do not always want that to happen
          because models with the same class name can differ. They are also meant to be
          temporary. Removing the model from the cache does not work because if there
          are multiple requests at the same, it is not removed from the cache on time
          which could result in hard failures. It is also hard to extend the
          django.apps.registry.apps so this hack extends the original `register_model`
          method and it will only call the original `register_model` method if the
          model is not a generated table model.
  
          If anyone has a better way to prevent the models from being registered then I
          am happy to hear about it! :)
          """$SEP$# Trigger the pending operations because the original register_model$SEP$# method also triggers them. Not triggering them can cause a memory$SEP$# leak because everytime a table model is generated, it will register$SEP$# new pending operations.