1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Use classmethod as a decorator.

This commit is contained in:
xuxiang
2013-11-20 10:02:30 +08:00
committed by Simon Charette
parent 73b3c257e3
commit 4cfe6ba6a3
4 changed files with 5 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ class Node(object):
# We need this because of django.db.models.query_utils.Q. Q. __init__() is
# problematic, but it is a natural Node subclass in all other respects.
@classmethod
def _new_instance(cls, children=None, connector=None, negated=False):
"""
This is called to create a new instance of this class when we need new
@@ -39,7 +40,6 @@ class Node(object):
obj = Node(children, connector, negated)
obj.__class__ = cls
return obj
_new_instance = classmethod(_new_instance)
def __str__(self):
if self.negated: