1
+ import warnings
2
+
1
3
from ...core .exceptions import SkipField
2
4
from ...core .fields import Field
3
5
from ...core .types .base import FieldType
4
6
from ...core .types .definitions import List
5
7
from ...relay import ConnectionField
6
8
from ...relay .utils import is_node
7
- from .utils import get_type_for_model , lazy_map
9
+ from .utils import get_type_for_model
8
10
9
11
10
12
class DjangoConnectionField (ConnectionField ):
11
- pass
12
-
13
-
14
- class LazyListField (Field ):
15
-
16
- def get_type (self , schema ):
17
- return List (self .type )
18
13
19
- def resolver (self , instance , args , info ):
20
- resolved = super (LazyListField , self ).resolver (instance , args , info )
21
- return lazy_map (resolved , self .type )
14
+ def __init__ (self , * args , ** kwargs ):
15
+ cls = self .__class__
16
+ warnings .warn ("Using {} will be not longer supported."
17
+ " Use relay.ConnectionField instead" .format (cls .__name__ ),
18
+ FutureWarning )
19
+ return super (DjangoConnectionField , self ).__init__ (* args , ** kwargs )
22
20
23
21
24
22
class ConnectionOrListField (Field ):
@@ -31,7 +29,7 @@ def internal_type(self, schema):
31
29
if is_node (field_object_type ):
32
30
field = DjangoConnectionField (field_object_type )
33
31
else :
34
- field = LazyListField ( field_object_type )
32
+ field = Field ( List ( field_object_type ) )
35
33
field .contribute_to_class (self .object_type , self .attname )
36
34
return schema .T (field )
37
35
0 commit comments