mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-11 08:42:32 +03:00
parent
b659aa62bd
commit
f9c5bc3e20
|
@ -25,7 +25,7 @@ class DjangoListField(Field):
|
||||||
_type = _type.of_type
|
_type = _type.of_type
|
||||||
|
|
||||||
# Django would never return a Set of None vvvvvvv
|
# Django would never return a Set of None vvvvvvv
|
||||||
super(DjangoListField, self).__init__(List(NonNull(_type)), *args, **kwargs)
|
super().__init__(List(NonNull(_type)), *args, **kwargs)
|
||||||
|
|
||||||
assert issubclass(
|
assert issubclass(
|
||||||
self._underlying_type, DjangoObjectType
|
self._underlying_type, DjangoObjectType
|
||||||
|
@ -80,7 +80,7 @@ class DjangoConnectionField(ConnectionField):
|
||||||
graphene_settings.RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST,
|
graphene_settings.RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST,
|
||||||
)
|
)
|
||||||
kwargs.setdefault("offset", Int())
|
kwargs.setdefault("offset", Int())
|
||||||
super(DjangoConnectionField, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
|
|
|
@ -25,7 +25,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
self._filtering_args = None
|
self._filtering_args = None
|
||||||
self._extra_filter_meta = extra_filter_meta
|
self._extra_filter_meta = extra_filter_meta
|
||||||
self._base_args = None
|
self._base_args = None
|
||||||
super(DjangoFilterConnectionField, self).__init__(type, *args, **kwargs)
|
super().__init__(type, *args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def args(self):
|
def args(self):
|
||||||
|
@ -71,7 +71,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
kwargs[k] = v
|
kwargs[k] = v
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
qs = super(DjangoFilterConnectionField, cls).resolve_queryset(
|
qs = super().resolve_queryset(
|
||||||
connection, iterable, info, args
|
connection, iterable, info, args
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class GlobalIDFilter(Filter):
|
||||||
_id = None
|
_id = None
|
||||||
if value is not None:
|
if value is not None:
|
||||||
_, _id = from_global_id(value)
|
_, _id = from_global_id(value)
|
||||||
return super(GlobalIDFilter, self).filter(qs, _id)
|
return super().filter(qs, _id)
|
||||||
|
|
||||||
|
|
||||||
class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
|
class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
|
||||||
|
@ -25,4 +25,4 @@ class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
|
||||||
|
|
||||||
def filter(self, qs, value):
|
def filter(self, qs, value):
|
||||||
gids = [from_global_id(v)[1] for v in value]
|
gids = [from_global_id(v)[1] for v in value]
|
||||||
return super(GlobalIDMultipleChoiceFilter, self).filter(qs, gids)
|
return super().filter(qs, gids)
|
||||||
|
|
|
@ -23,4 +23,4 @@ class ListFilter(TypedFilter):
|
||||||
else:
|
else:
|
||||||
return qs.none()
|
return qs.none()
|
||||||
else:
|
else:
|
||||||
return super(ListFilter, self).filter(qs, value)
|
return super().filter(qs, value)
|
||||||
|
|
|
@ -12,7 +12,7 @@ class TypedFilter(Filter):
|
||||||
|
|
||||||
def __init__(self, input_type=None, *args, **kwargs):
|
def __init__(self, input_type=None, *args, **kwargs):
|
||||||
self._input_type = input_type
|
self._input_type = input_type
|
||||||
super(TypedFilter, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def input_type(self):
|
def input_type(self):
|
||||||
|
|
|
@ -138,7 +138,7 @@ def test_filter_shortcut_filterset_context():
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def qs(self):
|
def qs(self):
|
||||||
qs = super(ArticleContextFilter, self).qs
|
qs = super().qs
|
||||||
return qs.filter(reporter=self.request.reporter)
|
return qs.filter(reporter=self.request.reporter)
|
||||||
|
|
||||||
class Query(ObjectType):
|
class Query(ObjectType):
|
||||||
|
|
|
@ -99,7 +99,7 @@ class DjangoFormMutation(BaseDjangoFormMutation):
|
||||||
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
||||||
|
|
||||||
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
||||||
super(DjangoFormMutation, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(
|
||||||
_meta=_meta, input_fields=input_fields, **options
|
_meta=_meta, input_fields=input_fields, **options
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class DjangoModelFormMutation(BaseDjangoFormMutation):
|
||||||
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
||||||
|
|
||||||
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
||||||
super(DjangoModelFormMutation, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(
|
||||||
_meta=_meta, input_fields=input_fields, **options
|
_meta=_meta, input_fields=input_fields, **options
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ class SerializerMutation(ClientIDMutation):
|
||||||
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
_meta.fields = yank_fields_from_attrs(output_fields, _as=Field)
|
||||||
|
|
||||||
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
input_fields = yank_fields_from_attrs(input_fields, _as=InputField)
|
||||||
super(SerializerMutation, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(
|
||||||
_meta=_meta, input_fields=input_fields, **options
|
_meta=_meta, input_fields=input_fields, **options
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ def test_django_objecttype_with_custom_meta():
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, **options):
|
def __init_subclass_with_meta__(cls, **options):
|
||||||
options.setdefault("_meta", ArticleTypeOptions(cls))
|
options.setdefault("_meta", ArticleTypeOptions(cls))
|
||||||
super(ArticleType, cls).__init_subclass_with_meta__(**options)
|
super().__init_subclass_with_meta__(**options)
|
||||||
|
|
||||||
class Article(ArticleType):
|
class Article(ArticleType):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -255,7 +255,7 @@ class DjangoObjectType(ObjectType):
|
||||||
_meta.fields = django_fields
|
_meta.fields = django_fields
|
||||||
_meta.connection = connection
|
_meta.connection = connection
|
||||||
|
|
||||||
super(DjangoObjectType, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(
|
||||||
_meta=_meta, interfaces=interfaces, **options
|
_meta=_meta, interfaces=interfaces, **options
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class HttpError(Exception):
|
||||||
def __init__(self, response, message=None, *args, **kwargs):
|
def __init__(self, response, message=None, *args, **kwargs):
|
||||||
self.response = response
|
self.response = response
|
||||||
self.message = message = message or response.content.decode()
|
self.message = message = message or response.content.decode()
|
||||||
super(HttpError, self).__init__(message, *args, **kwargs)
|
super().__init__(message, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def get_accepted_content_types(request):
|
def get_accepted_content_types(request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user