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
13
12
- def wrap_resolved (self , value , instance , args , info ):
13
- return lazy_map (value , self .type )
14
-
15
-
16
- class LazyListField (Field ):
17
-
18
- def get_type (self , schema ):
19
- return List (self .type )
20
-
21
- def resolver (self , instance , args , info ):
22
- resolved = super (LazyListField , self ).resolver (instance , args , info )
23
- 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 )
24
20
25
21
26
22
class ConnectionOrListField (Field ):
@@ -33,7 +29,7 @@ def internal_type(self, schema):
33
29
if is_node (field_object_type ):
34
30
field = DjangoConnectionField (field_object_type )
35
31
else :
36
- field = LazyListField ( field_object_type )
32
+ field = Field ( List ( field_object_type ) )
37
33
field .contribute_to_class (self .object_type , self .attname )
38
34
return schema .T (field )
39
35
0 commit comments