Skip to content

Commit 740596f

Browse files
authored
Merge pull request #124 from theoribeiro/master
Feat support GenericEmbeddedDocument
2 parents db3bc19 + 26f62d5 commit 740596f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1110
-1381
lines changed

docs/conf.py

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
3+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
44

55
# -*- coding: utf-8 -*-
66
#
@@ -34,46 +34,44 @@
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
3636
extensions = [
37-
'sphinx.ext.autodoc',
38-
'sphinx.ext.intersphinx',
39-
'sphinx.ext.todo',
40-
'sphinx.ext.coverage',
41-
'sphinx.ext.viewcode',
37+
"sphinx.ext.autodoc",
38+
"sphinx.ext.intersphinx",
39+
"sphinx.ext.todo",
40+
"sphinx.ext.coverage",
41+
"sphinx.ext.viewcode",
4242
]
4343
if not on_rtd:
44-
extensions += [
45-
'sphinx.ext.githubpages',
46-
]
44+
extensions += ["sphinx.ext.githubpages"]
4745

4846
# Add any paths that contain templates here, relative to this directory.
49-
templates_path = ['_templates']
47+
templates_path = ["_templates"]
5048

5149
# The suffix(es) of source filenames.
5250
# You can specify multiple suffix as a list of string:
5351
#
5452
# source_suffix = ['.rst', '.md']
55-
source_suffix = '.rst'
53+
source_suffix = ".rst"
5654

5755
# The encoding of source files.
5856
#
5957
# source_encoding = 'utf-8-sig'
6058

6159
# The master toctree document.
62-
master_doc = 'index'
60+
master_doc = "index"
6361

6462
# General information about the project.
65-
project = u'Graphene Mongo'
66-
copyright = u'Graphene 2018'
67-
author = u'Abaw Chen'
63+
project = u"Graphene Mongo"
64+
copyright = u"Graphene 2018"
65+
author = u"Abaw Chen"
6866

6967
# The version info for the project you're documenting, acts as replacement for
7068
# |version| and |release|, also used in various other places throughout the
7169
# built documents.
7270
#
7371
# The short X.Y version.
74-
version = u'0.1'
72+
version = u"0.1"
7573
# The full version, including alpha/beta/rc tags.
76-
release = u'0.1.2'
74+
release = u"0.1.2"
7775

7876
# The language for content autogenerated by Sphinx. Refer to documentation
7977
# for a list of supported languages.
@@ -94,7 +92,7 @@
9492
# List of patterns, relative to source directory, that match files and
9593
# directories to ignore when looking for source files.
9694
# This patterns also effect to html_static_path and html_extra_path
97-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
95+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
9896

9997
# The reST default role (used for this markup: `text`) to use for all
10098
# documents.
@@ -116,7 +114,7 @@
116114
# show_authors = False
117115

118116
# The name of the Pygments (syntax highlighting) style to use.
119-
pygments_style = 'sphinx'
117+
pygments_style = "sphinx"
120118

121119
# A list of ignored prefixes for module index sorting.
122120
# modindex_common_prefix = []
@@ -175,7 +173,7 @@
175173
# Add any paths that contain custom static files (such as style sheets) here,
176174
# relative to this directory. They are copied after the builtin static files,
177175
# so a file named "default.css" will overwrite the builtin "default.css".
178-
html_static_path = ['_static']
176+
html_static_path = ["_static"]
179177

180178
# Add any extra paths that contain custom files (such as robots.txt or
181179
# .htaccess) here, relative to this directory. These files are copied
@@ -255,34 +253,30 @@
255253
# html_search_scorer = 'scorer.js'
256254

257255
# Output file base name for HTML help builder.
258-
htmlhelp_basename = 'Graphenedoc'
256+
htmlhelp_basename = "Graphenedoc"
259257

260258
# -- Options for LaTeX output ---------------------------------------------
261259

262260
latex_elements = {
263-
# The paper size ('letterpaper' or 'a4paper').
264-
#
265-
# 'papersize': 'letterpaper',
266-
267-
# The font size ('10pt', '11pt' or '12pt').
268-
#
269-
# 'pointsize': '10pt',
270-
271-
# Additional stuff for the LaTeX preamble.
272-
#
273-
# 'preamble': '',
274-
275-
# Latex figure (float) alignment
276-
#
277-
# 'figure_align': 'htbp',
261+
# The paper size ('letterpaper' or 'a4paper').
262+
#
263+
# 'papersize': 'letterpaper',
264+
# The font size ('10pt', '11pt' or '12pt').
265+
#
266+
# 'pointsize': '10pt',
267+
# Additional stuff for the LaTeX preamble.
268+
#
269+
# 'preamble': '',
270+
# Latex figure (float) alignment
271+
#
272+
# 'figure_align': 'htbp',
278273
}
279274

280275
# Grouping the document tree into LaTeX files. List of tuples
281276
# (source start file, target name, title,
282277
# author, documentclass [howto, manual, or own class]).
283278
latex_documents = [
284-
(master_doc, 'Graphene.tex', u'Graphene Documentation',
285-
u'Syrus Akbary', 'manual'),
279+
(master_doc, "Graphene.tex", u"Graphene Documentation", u"Syrus Akbary", "manual")
286280
]
287281

288282
# The name of an image file (relative to this directory) to place at the top of
@@ -323,8 +317,7 @@
323317
# One entry per manual page. List of tuples
324318
# (source start file, name, description, authors, manual section).
325319
man_pages = [
326-
(master_doc, 'graphene_django', u'Graphene Django Documentation',
327-
[author], 1)
320+
(master_doc, "graphene_django", u"Graphene Django Documentation", [author], 1)
328321
]
329322

330323
# If true, show URL addresses after external links.
@@ -338,9 +331,15 @@
338331
# (source start file, target name, title, author,
339332
# dir menu entry, description, category)
340333
texinfo_documents = [
341-
(master_doc, 'Graphene-Django', u'Graphene Django Documentation',
342-
author, 'Graphene Django', 'One line description of project.',
343-
'Miscellaneous'),
334+
(
335+
master_doc,
336+
"Graphene-Django",
337+
u"Graphene Django Documentation",
338+
author,
339+
"Graphene Django",
340+
"One line description of project.",
341+
"Miscellaneous",
342+
)
344343
]
345344

346345
# Documents to append as an appendix to all manuals.
@@ -414,7 +413,7 @@
414413
# epub_post_files = []
415414

416415
# A list of files that should not be packed into the epub file.
417-
epub_exclude_files = ['search.html']
416+
epub_exclude_files = ["search.html"]
418417

419418
# The depth of the table of contents in toc.ncx.
420419
#
@@ -446,5 +445,4 @@
446445

447446

448447
# Example configuration for intersphinx: refer to the Python standard library.
449-
intersphinx_mapping = {'https://docs.python.org/': None}
450-
448+
intersphinx_mapping = {"https://docs.python.org/": None}

examples/django_mongoengine/bike/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class BikeConfig(AppConfig):
5-
name = 'bike'
5+
name = "bike"

examples/django_mongoengine/bike/fixtures.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@
55
def fixture_bike_data():
66
Bike.drop_collection()
77
bike_one = Bike(
8-
name='Level R',
9-
brand='Mondraker',
10-
year='2020',
11-
size=['S', 'M', 'L', 'XL'],
8+
name="Level R",
9+
brand="Mondraker",
10+
year="2020",
11+
size=["S", "M", "L", "XL"],
1212
wheel_size=27.5,
13-
type='MTB'
13+
type="MTB",
1414
)
1515
bike_one.save()
1616

1717
bike_two = Bike(
18-
name='CAADX ULTEGRA',
19-
brand='Cannondale',
20-
year='2019',
21-
size=['46', '51', '54', '58'],
18+
name="CAADX ULTEGRA",
19+
brand="Cannondale",
20+
year="2019",
21+
size=["46", "51", "54", "58"],
2222
wheel_size=28,
23-
type='Gravel'
23+
type="Gravel",
2424
)
2525
bike_two.save()
2626

2727
bike_three = Bike(
2828
id="507f1f77bcf86cd799439011",
29-
name='Moterra Neo',
30-
brand='Cannondale',
31-
year='2019',
29+
name="Moterra Neo",
30+
brand="Cannondale",
31+
year="2019",
3232
size=["M", "L", "XL"],
3333
wheel_size=29,
34-
type='EBike'
34+
type="EBike",
3535
)
3636
bike_three.save()
3737

@@ -41,18 +41,18 @@ def fixture_shop_data():
4141
shop_one = Shop(
4242
name="Big Wheel Bicycles",
4343
address="2438 Hart Ridge Road",
44-
website="https://www.bigwheelbike.test"
44+
website="https://www.bigwheelbike.test",
4545
)
4646
shop_one.save()
4747
shop_two = Shop(
4848
name="Bike Tech",
4949
address="2175 Pearl Street",
50-
website="https://www.biketech.test"
50+
website="https://www.biketech.test",
5151
)
5252
shop_two.save()
5353

5454

55-
@pytest.fixture(scope='module')
55+
@pytest.fixture(scope="module")
5656
def fixtures_data():
5757
fixture_bike_data()
5858
fixture_shop_data()

examples/django_mongoengine/bike/models.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
from mongoengine import Document
22
from mongoengine.fields import (
3-
FloatField, StringField,
4-
ListField, URLField, ObjectIdField
3+
FloatField,
4+
StringField,
5+
ListField,
6+
URLField,
7+
ObjectIdField,
58
)
69

710

811
class Shop(Document):
9-
meta = {'collection': 'shop'}
12+
meta = {"collection": "shop"}
1013
ID = ObjectIdField()
1114
name = StringField()
1215
address = StringField()
1316
website = URLField()
1417

1518

1619
class Bike(Document):
17-
meta = {'collection': 'bike'}
20+
meta = {"collection": "bike"}
1821
ID = ObjectIdField()
1922
name = StringField()
2023
brand = StringField()

examples/django_mongoengine/bike/mutations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def mutate(self, info, bike_data=None):
2727
year=bike_data.year,
2828
size=bike_data.size,
2929
wheel_size=bike_data.wheel_size,
30-
type=bike_data.type
30+
type=bike_data.type,
3131
)
3232
bike.save()
3333

0 commit comments

Comments
 (0)