Skip to content

Commit

Permalink
Fixed code blocks in readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
beregond committed Nov 2, 2015
1 parent a0176ea commit cb7e887
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,42 +223,39 @@ Features

* Lazy loading, best for circular references:

..code-block:: python

class Primary(models.Base):

name = fields.StringField()
secondary = fields.EmbeddedField('Secondary')

.. code-block:: python
class Secondary(models.Base):
>>> class Primary(models.Base):
...
... name = fields.StringField()
... secondary = fields.EmbeddedField('Secondary')
data = fields.IntField()
first = fields.EmbeddedField('Primary')
>>> class Secondary(models.Base):
...
... data = fields.IntField()
... first = fields.EmbeddedField('Primary')
You can use either `Model`, full path `path.to.Model` or relative imports
`.Model` or `...Model`.

* Using definitions to generate schema for circular references:

..code-block:: python

class File(models.Base):

name = fields.StringField()
size = fields.FloatField()


class Directory(models.Base):

name = fields.StringField()
children = fields.ListField(['Directory', File])
.. code-block:: python
>>> class File(models.Base):
...
... name = fields.StringField()
... size = fields.FloatField()
class Filesystem(models.Base):
>>> class Directory(models.Base):
...
... name = fields.StringField()
... children = fields.ListField(['Directory', File])
name = fields.StringField()
children = fields.ListField([Directory, File])
>>> class Filesystem(models.Base):
...
... name = fields.StringField()
... children = fields.ListField([Directory, File])
>>> Filesystem.to_json_schema()
{
Expand Down

0 comments on commit cb7e887

Please sign in to comment.