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):
58
58
59
59
# start-embedded-field
60
60
from django .db import models
61
+ from django_mongodb_backend .models import EmbeddedModel
61
62
from django_mongodb_backend .fields import EmbeddedModelField
62
63
63
- class Award (models . Model ):
64
+ class Award (EmbeddedModel ):
64
65
wins = models .IntegerField (default = 0 )
65
66
nominations = models .IntegerField (default = 0 )
66
67
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
171
171
with {+django-odm+}, see the :ref:`django-models-embedded` section in this guide.
172
172
173
173
* - ``ObjectId``
174
- - ``ObjectIdAutoField ``
174
+ - ``ObjectIdField ``
175
175
- | Stores unique 12-byte identifiers that MongoDB uses as primary keys.
176
176
177
177
* - ``Binary``
@@ -216,7 +216,7 @@ To create an model that represents a MongoDB collection, add your model
216
216
class definitions to your application's ``models.py`` file. In your model
217
217
class, specify the fields you want to store and include any model metadata
218
218
in 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
220
220
define a model:
221
221
222
222
.. code-block:: python
@@ -226,11 +226,11 @@ define a model:
226
226
<field name> = <data type>
227
227
# Include additional fields here
228
228
229
- class Meta:
230
- # Include metadata here
229
+ class Meta:
230
+ # Include metadata here
231
231
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
234
234
235
235
To use your models, you must add them to your project's
236
236
``settings.py`` file. Edit the ``INSTALLED_APPS`` value to include
You can’t perform that action at this time.
0 commit comments