mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-01-31 11:48:38 +03:00
Remove Django1.7 shims
This commit is contained in:
parent
24706f50d4
commit
d2db5f5584
|
@ -8,12 +8,6 @@ from .utils import import_single_dispatch
|
||||||
|
|
||||||
singledispatch = import_single_dispatch()
|
singledispatch = import_single_dispatch()
|
||||||
|
|
||||||
try:
|
|
||||||
UUIDField = forms.UUIDField
|
|
||||||
except AttributeError:
|
|
||||||
class UUIDField(object):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def convert_form_field(field):
|
def convert_form_field(field):
|
||||||
|
@ -36,7 +30,7 @@ def convert_form_field_to_string(field):
|
||||||
return String(description=field.help_text, required=field.required)
|
return String(description=field.help_text, required=field.required)
|
||||||
|
|
||||||
|
|
||||||
@convert_form_field.register(UUIDField)
|
@convert_form_field.register(forms.UUIDField)
|
||||||
def convert_form_field_to_uuid(field):
|
def convert_form_field_to_uuid(field):
|
||||||
return UUID(description=field.help_text, required=field.required)
|
return UUID(description=field.help_text, required=field.required)
|
||||||
|
|
||||||
|
|
|
@ -1,64 +1,33 @@
|
||||||
import importlib
|
import importlib
|
||||||
import json
|
import json
|
||||||
from distutils.version import StrictVersion
|
|
||||||
from optparse import make_option
|
|
||||||
|
|
||||||
from django import get_version as get_django_version
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
from graphene_django.settings import graphene_settings
|
from graphene_django.settings import graphene_settings
|
||||||
|
|
||||||
LT_DJANGO_1_8 = StrictVersion(get_django_version()) < StrictVersion('1.8')
|
class CommandArguments(BaseCommand):
|
||||||
|
|
||||||
if LT_DJANGO_1_8:
|
def add_arguments(self, parser):
|
||||||
class CommandArguments(BaseCommand):
|
parser.add_argument(
|
||||||
option_list = BaseCommand.option_list + (
|
'--schema',
|
||||||
make_option(
|
type=str,
|
||||||
'--schema',
|
dest='schema',
|
||||||
type=str,
|
default=graphene_settings.SCHEMA,
|
||||||
dest='schema',
|
help='Django app containing schema to dump, e.g. myproject.core.schema.schema')
|
||||||
default='',
|
|
||||||
help='Django app containing schema to dump, e.g. myproject.core.schema.schema',
|
|
||||||
),
|
|
||||||
make_option(
|
|
||||||
'--out',
|
|
||||||
type=str,
|
|
||||||
dest='out',
|
|
||||||
default='',
|
|
||||||
help='Output file (default: schema.json)'
|
|
||||||
),
|
|
||||||
make_option(
|
|
||||||
'--indent',
|
|
||||||
type=int,
|
|
||||||
dest='indent',
|
|
||||||
default=None,
|
|
||||||
help='Output file indent (default: None)'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
class CommandArguments(BaseCommand):
|
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
parser.add_argument(
|
||||||
parser.add_argument(
|
'--out',
|
||||||
'--schema',
|
type=str,
|
||||||
type=str,
|
dest='out',
|
||||||
dest='schema',
|
default=graphene_settings.SCHEMA_OUTPUT,
|
||||||
default=graphene_settings.SCHEMA,
|
help='Output file (default: schema.json)')
|
||||||
help='Django app containing schema to dump, e.g. myproject.core.schema.schema')
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--out',
|
'--indent',
|
||||||
type=str,
|
type=int,
|
||||||
dest='out',
|
dest='indent',
|
||||||
default=graphene_settings.SCHEMA_OUTPUT,
|
default=graphene_settings.SCHEMA_INDENT,
|
||||||
help='Output file (default: schema.json)')
|
help='Output file indent (default: None)')
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
'--indent',
|
|
||||||
type=int,
|
|
||||||
dest='indent',
|
|
||||||
default=graphene_settings.SCHEMA_INDENT,
|
|
||||||
help='Output file indent (default: None)')
|
|
||||||
|
|
||||||
|
|
||||||
class Command(CommandArguments):
|
class Command(CommandArguments):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user