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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user