1. 28 Ara, 2013 5 kayıt (commit)
    • Aymeric Augustin's avatar
      Used app_label instead of appname. · c81fae6b
      Aymeric Augustin yazdı
      The last component of the dotted path to the application module is
      consistently referenced as the application "label". For instance it's
      AppConfig.label. appname could be confused with AppConfig.name, which is
      the full dotted path.
      c81fae6b
    • Aymeric Augustin's avatar
    • Aymeric Augustin's avatar
    • Aymeric Augustin's avatar
      Simplified the implementation of register_model. · aff57793
      Aymeric Augustin yazdı
      register_model is called exactly once in the entire Django code base, at the
      bottom of ModelBase.__new__:
      
          new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
      
      ModelBase.__new__ exits prematurely 120 lines earlier (sigh) if a model with
      the same name is already registered:
      
          if new_class._meta.apps.get_registered_model(new_class._meta.app_label, name):
              return
      
      (This isn't the exact code, but it's equivalent.)
      
      apps.register_model and apps.get_registered_model are essentially a setter and
      a getter for apps.all_models, and apps.register_model is the only setter. As a
      consequence, new_class._meta.apps.all_models cannot change in-between.
      
      Considering that name == new_class.__name__, we can conclude that
      register_model(app_label, model) is always called with such arguments that
      get_registered_model(app_label, model.__name__) returns None.
      
      Considering that model._meta.model_name == model.__name__.lower(), and looking
      at the implementation of register_model and get_registered_model, this proves
      that self.all_models[app_label] doesn't contain model._meta.model_name in
      register_model, allowing us to simplify the implementation.
      aff57793
    • Ramiro Morales's avatar
      Amend test table name so it doesn't clash. · 3518e9ec
      Ramiro Morales yazdı
      Refs #21692 and 3efd1b8b.
      3518e9ec
  2. 27 Ara, 2013 10 kayıt (commit)
  3. 26 Ara, 2013 17 kayıt (commit)
  4. 25 Ara, 2013 8 kayıt (commit)