mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-25 02:54:06 +03:00
Cleaned up unused imports and variables. (#1146)
* Cleaned up used imports and variables. * Optimized imports. * Fixed mixed imports.
This commit is contained in:
parent
fe66b48d38
commit
212524fd8c
|
@ -156,8 +156,8 @@ class DjangoConnectionField(ConnectionField):
|
|||
# AssertionError
|
||||
after = min(get_offset_with_default(args.get("after"), -1) + 1, list_length)
|
||||
|
||||
if max_limit is not None and args.get("first", None) == None:
|
||||
if args.get("last", None) != None:
|
||||
if max_limit is not None and args.get("first", None) is None:
|
||||
if args.get("last", None) is not None:
|
||||
after = list_length - args["last"]
|
||||
else:
|
||||
args["first"] = max_limit
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import itertools
|
||||
|
||||
from django.db import models
|
||||
from django_filters import Filter, MultipleChoiceFilter
|
||||
from django_filters.filterset import BaseFilterSet, FilterSet
|
||||
from django_filters.filterset import FILTER_FOR_DBFIELD_DEFAULTS
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
import graphene
|
||||
|
||||
from django import forms
|
||||
from django_filters.utils import get_model_field
|
||||
|
||||
from django_filters.utils import get_model_field, get_field_parts
|
||||
from django_filters.filters import Filter, BaseCSVFilter
|
||||
|
||||
from .filterset import custom_filterset_factory, setup_filterset
|
||||
from .filters import ArrayFilter, ListFilter, RangeFilter
|
||||
from .filterset import custom_filterset_factory, setup_filterset
|
||||
from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField
|
||||
|
||||
|
||||
|
|
|
@ -14,10 +14,6 @@ from graphene.types.utils import yank_fields_from_attrs
|
|||
from graphene_django.constants import MUTATION_ERRORS_FLAG
|
||||
from graphene_django.registry import get_global_registry
|
||||
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import connection
|
||||
|
||||
from ..types import ErrorType
|
||||
from .converter import convert_form_field
|
||||
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
import graphene
|
||||
|
||||
from ..types import ErrorType # noqa Import ErrorType for backwards compatability
|
||||
|
|
|
@ -2,11 +2,8 @@ import warnings
|
|||
from collections import OrderedDict
|
||||
from typing import Type
|
||||
|
||||
from django.db.models import Model
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
import graphene
|
||||
from graphene import Field
|
||||
from django.db.models import Model
|
||||
from graphene.relay import Connection, Node
|
||||
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
|
||||
from graphene.types.utils import yank_fields_from_attrs
|
||||
|
@ -21,7 +18,6 @@ from .utils import (
|
|||
is_valid_django_model,
|
||||
)
|
||||
|
||||
|
||||
ALL_FIELDS = "__all__"
|
||||
|
||||
|
||||
|
@ -108,12 +104,7 @@ def validate_fields(type_, model, fields, only_fields, exclude_fields):
|
|||
(
|
||||
'Excluding the custom field "{field_name}" on DjangoObjectType "{type_}" has no effect. '
|
||||
'Either remove the custom field or remove the field from the "exclude" list.'
|
||||
).format(
|
||||
field_name=name,
|
||||
app_label=model._meta.app_label,
|
||||
object_name=model._meta.object_name,
|
||||
type_=type_,
|
||||
)
|
||||
).format(field_name=name, type_=type_)
|
||||
)
|
||||
else:
|
||||
if not hasattr(model, name):
|
||||
|
@ -232,7 +223,7 @@ class DjangoObjectType(ObjectType):
|
|||
|
||||
django_fields = yank_fields_from_attrs(
|
||||
construct_fields(model, registry, fields, exclude, convert_choices_to_enum),
|
||||
_as=Field,
|
||||
_as=graphene.Field,
|
||||
)
|
||||
|
||||
if use_connection is None and interfaces:
|
||||
|
|
Loading…
Reference in New Issue
Block a user