Skip to content

Commit fb90cb7

Browse files
committed
Merge branch 'master' into v3
2 parents 680bf72 + b1f6d41 commit fb90cb7

File tree

9 files changed

+89
-9
lines changed

9 files changed

+89
-9
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: "\U0001F41Bbug"
6+
assignees: ''
7+
8+
---
9+
10+
**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.
11+
12+
* **What is the current behavior?**
13+
14+
15+
16+
* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
17+
a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).
18+
19+
20+
21+
* **What is the expected behavior?**
22+
23+
24+
25+
* **What is the motivation / use case for changing the behavior?**
26+
27+
28+
29+
* **Please tell us about your environment:**
30+
31+
- Version:
32+
- Platform:
33+
34+
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: "✨enhancement"
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

docs/fields.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Custom resolvers
4747
If your ``DjangoObjectType`` has defined a custom
4848
:ref:`get_queryset<django-objecttype-get-queryset>` method, when resolving a
4949
``DjangoListField`` it will be called with either the return of the field
50-
resolver (if one is defined) or the default queryeset from the Django model.
50+
resolver (if one is defined) or the default queryset from the Django model.
5151

5252
For example the following schema will only resolve recipes which have been
5353
published and have a title:

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Graphene-Django provides some additional abstractions that make it easy to add G
99
First time? We recommend you start with the installation guide to get set up and the basic tutorial.
1010
It is worth reading the `core graphene docs <https://docs.graphene-python.org/en/latest/>`__ to familiarize yourself with the basic utilities.
1111

12-
Core tenants
13-
------------
12+
Core tenets
13+
-----------
1414

1515
If you want to expose your data through GraphQL - read the ``Installation``, ``Schema`` and ``Queries`` section.
1616

graphene_django/debug/sql/tracking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ def _record(self, method, sql, params):
147147
# We keep `sql` to maintain backwards compatibility
148148
self.logger.object.sql.append(_sql)
149149

150-
def callproc(self, procname, params=()):
150+
def callproc(self, procname, params=None):
151151
return self._record(self.cursor.callproc, procname, params)
152152

153-
def execute(self, sql, params=()):
153+
def execute(self, sql, params=None):
154154
return self._record(self.cursor.execute, sql, params)
155155

156156
def executemany(self, sql, param_list):

graphene_django/tests/test_query.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,31 @@ def resolve_reporter(self, info):
6060
assert result.data == {"reporter": {"id": "1"}}
6161

6262

63+
def test_should_query_wrapped_simplelazy_objects():
64+
class ReporterType(DjangoObjectType):
65+
class Meta:
66+
model = Reporter
67+
fields = ("id",)
68+
69+
class Query(graphene.ObjectType):
70+
reporter = graphene.Field(ReporterType)
71+
72+
def resolve_reporter(self, info):
73+
return SimpleLazyObject(lambda: SimpleLazyObject(lambda: Reporter(id=1)))
74+
75+
schema = graphene.Schema(query=Query)
76+
query = """
77+
query {
78+
reporter {
79+
id
80+
}
81+
}
82+
"""
83+
result = schema.execute(query)
84+
assert not result.errors
85+
assert result.data == {"reporter": {"id": "1"}}
86+
87+
6388
def test_should_query_well():
6489
class ReporterType(DjangoObjectType):
6590
class Meta:

graphene_django/types.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,9 @@ def resolve_id(self, info):
269269

270270
@classmethod
271271
def is_type_of(cls, root, info):
272-
if isinstance(root, SimpleLazyObject):
273-
root._setup()
274-
root = root._wrapped
275272
if isinstance(root, cls):
276273
return True
277-
if not is_valid_django_model(type(root)):
274+
if not is_valid_django_model(root.__class__):
278275
raise Exception(('Received incompatible instance "{}".').format(root))
279276

280277
if cls._meta.model._meta.proxy:

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ setenv =
2323
deps =
2424
-e.[test]
2525
psycopg2-binary
26+
django111: Django>=1.11,<2.0
27+
django20: Django>=2.0,<2.1
28+
django21: Django>=2.1,<2.2
2629
django22: Django>=2.2,<3.0
2730
django30: Django>=3.0a1,<3.1
2831
djangomaster: https://github.com/django/django/archive/master.zip

0 commit comments

Comments
 (0)