File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -58,9 +58,10 @@ def __str__(self):
5858
5959# start-embedded-field
6060from django .db import models
61+ from django_mongodb_backend .models import EmbeddedModel
6162from django_mongodb_backend .fields import EmbeddedModelField
6263
63- class Award (models . Model ):
64+ class Award (EmbeddedModel ):
6465 wins = models .IntegerField (default = 0 )
6566 nominations = models .IntegerField (default = 0 )
6667 text = models .CharField (max_length = 100 )
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ The following table describes supported BSON field types and their
171171 with {+django-odm+}, see the :ref:`django-models-embedded` section in this guide.
172172
173173 * - ``ObjectId``
174- - ``ObjectIdAutoField ``
174+ - ``ObjectIdField ``
175175 - | Stores unique 12-byte identifiers that MongoDB uses as primary keys.
176176
177177 * - ``Binary``
@@ -216,7 +216,7 @@ To create an model that represents a MongoDB collection, add your model
216216class definitions to your application's ``models.py`` file. In your model
217217class, specify the fields you want to store and include any model metadata
218218in an inner ``Meta`` class. You can also use the ``__str__()`` method to
219- define a string representation of your model. Use the following syntax to
219+ define the string representation of your model. Use the following syntax to
220220define a model:
221221
222222.. code-block:: python
@@ -226,11 +226,11 @@ define a model:
226226 <field name> = <data type>
227227 # Include additional fields here
228228
229- class Meta:
230- # Include metadata here
229+ class Meta:
230+ # Include metadata here
231231
232- def __str__(self):
233- # Include logic for displaying your model as a string here
232+ def __str__(self):
233+ # Include logic for displaying your model as a string here
234234
235235To use your models, you must add them to your project's
236236``settings.py`` file. Edit the ``INSTALLED_APPS`` value to include
You can’t perform that action at this time.
0 commit comments