diff --git a/.gitignore b/.gitignore index 99bcd19..d243068 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,50 @@ _build build django_eav.egg-info/* +env/ + +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el \ No newline at end of file diff --git a/eav/registry.py b/eav/registry.py index 84646aa..777770d 100644 --- a/eav/registry.py +++ b/eav/registry.py @@ -119,12 +119,18 @@ class Registry(object): ''' Attach the manager to *manager_attr* specified in *config_cls* ''' - # save the old manager if the attribute name conflict with the new one + # Save the old manager if the attribute name conflict with the new one. if hasattr(self.model_cls, self.config_cls.manager_attr): mgr = getattr(self.model_cls, self.config_cls.manager_attr) self.config_cls.old_mgr = mgr - # attache the new manager to the model + # Remove default 'objects' manager. + for i, manager in enumerate(self.model_cls._meta.local_managers): + if manager.name == 'objects': + del self.model_cls._meta.local_managers[i] + self.model_cls._meta._expire_cache() + + # Attach the new manager to the model. mgr = EntityManager() mgr.contribute_to_class(self.model_cls, self.config_cls.manager_attr)