Skip to content

Commit 961404f

Browse files
authored
Merge pull request #339 from urbandove/rm-django1.7
Remove Django1.7 shims
2 parents b54e02c + f31db13 commit 961404f

File tree

2 files changed

+25
-61
lines changed

2 files changed

+25
-61
lines changed

graphene_django/form_converter.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88

99
singledispatch = import_single_dispatch()
1010

11-
try:
12-
UUIDField = forms.UUIDField
13-
except AttributeError:
14-
class UUIDField(object):
15-
pass
16-
1711

1812
@singledispatch
1913
def convert_form_field(field):
@@ -36,7 +30,7 @@ def convert_form_field_to_string(field):
3630
return String(description=field.help_text, required=field.required)
3731

3832

39-
@convert_form_field.register(UUIDField)
33+
@convert_form_field.register(forms.UUIDField)
4034
def convert_form_field_to_uuid(field):
4135
return UUID(description=field.help_text, required=field.required)
4236

graphene_django/management/commands/graphql_schema.py

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,34 @@
11
import importlib
22
import json
3-
from distutils.version import StrictVersion
4-
from optparse import make_option
53

6-
from django import get_version as get_django_version
74
from django.core.management.base import BaseCommand, CommandError
85

96
from graphene_django.settings import graphene_settings
107

11-
LT_DJANGO_1_8 = StrictVersion(get_django_version()) < StrictVersion('1.8')
12-
13-
if LT_DJANGO_1_8:
14-
class CommandArguments(BaseCommand):
15-
option_list = BaseCommand.option_list + (
16-
make_option(
17-
'--schema',
18-
type=str,
19-
dest='schema',
20-
default='',
21-
help='Django app containing schema to dump, e.g. myproject.core.schema.schema',
22-
),
23-
make_option(
24-
'--out',
25-
type=str,
26-
dest='out',
27-
default='',
28-
help='Output file (default: schema.json)'
29-
),
30-
make_option(
31-
'--indent',
32-
type=int,
33-
dest='indent',
34-
default=None,
35-
help='Output file indent (default: None)'
36-
),
37-
)
38-
else:
39-
class CommandArguments(BaseCommand):
40-
41-
def add_arguments(self, parser):
42-
parser.add_argument(
43-
'--schema',
44-
type=str,
45-
dest='schema',
46-
default=graphene_settings.SCHEMA,
47-
help='Django app containing schema to dump, e.g. myproject.core.schema.schema')
48-
49-
parser.add_argument(
50-
'--out',
51-
type=str,
52-
dest='out',
53-
default=graphene_settings.SCHEMA_OUTPUT,
54-
help='Output file (default: schema.json)')
55-
56-
parser.add_argument(
57-
'--indent',
58-
type=int,
59-
dest='indent',
60-
default=graphene_settings.SCHEMA_INDENT,
61-
help='Output file indent (default: None)')
8+
9+
class CommandArguments(BaseCommand):
10+
11+
def add_arguments(self, parser):
12+
parser.add_argument(
13+
'--schema',
14+
type=str,
15+
dest='schema',
16+
default=graphene_settings.SCHEMA,
17+
help='Django app containing schema to dump, e.g. myproject.core.schema.schema')
18+
19+
parser.add_argument(
20+
'--out',
21+
type=str,
22+
dest='out',
23+
default=graphene_settings.SCHEMA_OUTPUT,
24+
help='Output file (default: schema.json)')
25+
26+
parser.add_argument(
27+
'--indent',
28+
type=int,
29+
dest='indent',
30+
default=graphene_settings.SCHEMA_INDENT,
31+
help='Output file indent (default: None)')
6232

6333

6434
class Command(CommandArguments):

0 commit comments

Comments
 (0)