mirror of https://github.com/django/django.git
Removed unnecessary type() calls for class methods.
This commit is contained in:
parent
80f4ecc647
commit
af1434329f
|
@ -18,7 +18,7 @@ class SessionStore(SessionBase):
|
||||||
Implement a file based session store.
|
Implement a file based session store.
|
||||||
"""
|
"""
|
||||||
def __init__(self, session_key=None):
|
def __init__(self, session_key=None):
|
||||||
self.storage_path = type(self)._get_storage_path()
|
self.storage_path = self._get_storage_path()
|
||||||
self.file_prefix = settings.SESSION_COOKIE_NAME
|
self.file_prefix = settings.SESSION_COOKIE_NAME
|
||||||
super().__init__(session_key)
|
super().__init__(session_key)
|
||||||
|
|
||||||
|
|
|
@ -234,17 +234,14 @@ class LookupTests(TestCase):
|
||||||
__exact=None is transformed to __isnull=True if a custom lookup class
|
__exact=None is transformed to __isnull=True if a custom lookup class
|
||||||
with lookup_name != 'exact' is registered as the `exact` lookup.
|
with lookup_name != 'exact' is registered as the `exact` lookup.
|
||||||
"""
|
"""
|
||||||
class CustomExactLookup(models.Lookup):
|
|
||||||
lookup_name = 'somecustomlookup'
|
|
||||||
|
|
||||||
field = Author._meta.get_field('birthdate')
|
field = Author._meta.get_field('birthdate')
|
||||||
OldExactLookup = field.get_lookup('exact')
|
OldExactLookup = field.get_lookup('exact')
|
||||||
author = Author.objects.create(name='author', birthdate=None)
|
author = Author.objects.create(name='author', birthdate=None)
|
||||||
try:
|
try:
|
||||||
type(field).register_lookup(Exactly, 'exact')
|
field.register_lookup(Exactly, 'exact')
|
||||||
self.assertEqual(Author.objects.get(birthdate__exact=None), author)
|
self.assertEqual(Author.objects.get(birthdate__exact=None), author)
|
||||||
finally:
|
finally:
|
||||||
type(field).register_lookup(OldExactLookup, 'exact')
|
field.register_lookup(OldExactLookup, 'exact')
|
||||||
|
|
||||||
def test_basic_lookup(self):
|
def test_basic_lookup(self):
|
||||||
a1 = Author.objects.create(name='a1', age=1)
|
a1 = Author.objects.create(name='a1', age=1)
|
||||||
|
|
Loading…
Reference in New Issue