Permalink
Browse files

Django codestyle variable names

  • Loading branch information...
1 parent 773bb42 commit 2b5421c70866e0bd7f6c2cade462d858d3ba049e @anton-ryzhov anton-ryzhov committed Sep 16, 2012
Showing with 8 additions and 8 deletions.
  1. +7 −7 django/db/models/manager.py
  2. +1 −1 tests/modeltests/custom_managers/models.py
@@ -46,15 +46,15 @@ class Manager(object):
# Tracks each time a Manager instance is created. Used to retain order.
creation_counter = 0
- def __init__(self, QuerySetClass=QuerySet, EmptyQuerySetClass=EmptyQuerySet, RawQuerySetClass=RawQuerySet):
+ def __init__(self, query_set_class=QuerySet, empty_query_set_class=EmptyQuerySet, raw_query_set_class=RawQuerySet):
super(Manager, self).__init__()
self._set_creation_counter()
self.model = None
self._inherited = False
self._db = None
- self.QuerySetClass = QuerySetClass
- self.EmptyQuerySetClass = EmptyQuerySetClass
- self.RawQuerySetClass = RawQuerySetClass
+ self.query_set_class = query_set_class
+ self.empty_query_set_class = empty_query_set_class
+ self.raw_query_set_class = raw_query_set_class
def contribute_to_class(self, model, name):
# TODO: Use weakref because of possible memory leak / circular reference.
@@ -104,13 +104,13 @@ def db(self):
#######################
def get_empty_query_set(self):
- return self.EmptyQuerySetClass(self.model, using=self._db)
+ return self.empty_query_set_class(self.model, using=self._db)
def get_query_set(self):
"""Returns a new QuerySet object. Subclasses can override this method
to easily customize the behavior of the Manager.
"""
- return self.QuerySetClass(self.model, using=self._db)
+ return self.query_set_class(self.model, using=self._db)
def none(self):
return self.get_empty_query_set()
@@ -209,7 +209,7 @@ def _update(self, values, **kwargs):
return self.get_query_set()._update(values, **kwargs)
def raw(self, raw_query, params=None, *args, **kwargs):
- return self.RawQuerySetClass(raw_query=raw_query, model=self.model, params=params, using=self._db, *args, **kwargs)
+ return self.raw_query_set_class(raw_query=raw_query, model=self.model, params=params, using=self._db, *args, **kwargs)
class ManagerDescriptor(object):
# This class ensures managers aren't accessible via model instances.
@@ -77,7 +77,7 @@ class User(models.Model):
firstname = models.CharField(max_length=10)
middlename = models.CharField(max_length=10)
lastname = models.CharField(max_length=10)
- objects = models.Manager(QuerySetClass=UserQuerySet)
+ objects = models.Manager(query_set_class=UserQuerySet)
def __str__(self):
return self.firstname

0 comments on commit 2b5421c

Please sign in to comment.