Code

Ticket #19653: 0001-Fixed-19653-Make-sure-get_empty_query_set-calls-get_.patch

File 0001-Fixed-19653-Make-sure-get_empty_query_set-calls-get_.patch, 1.0 KB (added by charettes, 15 months ago)
  • django/db/models/manager.py

    From 350ec6406532c51d7f12144abf7d4534a5444c4f Mon Sep 17 00:00:00 2001
    From: Simon Charette <charette.s@gmail.com>
    Date: Tue, 22 Jan 2013 05:05:51 -0500
    Subject: [PATCH] Fixed 19653 -- Make sure get_empty_query_set calls
     get_query_set
    
    ---
     django/db/models/manager.py |    4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/django/db/models/manager.py b/django/db/models/manager.py
    index 816f619..aeb5fa0 100644
    a b class Manager(object): 
    113113    ####################### 
    114114 
    115115    def get_empty_query_set(self): 
    116         return QuerySet(self.model, using=self._db).none() 
     116        return self.get_query_set().none() 
    117117 
    118118    def get_query_set(self): 
    119119        """Returns a new QuerySet object.  Subclasses can override this method 
    class EmptyManager(Manager): 
    266266        self.model = model 
    267267 
    268268    def get_query_set(self): 
    269         return self.get_empty_query_set() 
     269        return super(EmptyManager, self).get_query_set().none()