-
Notifications
You must be signed in to change notification settings - Fork 7
DOCSP-46325: Models #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for docs-django ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
source/model-data/models.txt
Outdated
class Meta: | ||
# Include metadata here | ||
|
||
def __str__(self): | ||
# Include logic for displaying your model as a string here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two need indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw you refreshed! I'll resolve the ones that have already been fixed. :)
source/model-data/models.txt
Outdated
with {+django-odm+}, see the :ref:`django-models-embedded` section in this guide. | ||
|
||
* - ``ObjectId`` | ||
- ``ObjectIdAutoField`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ``ObjectIdAutoField`` | |
- ``ObjectIdField`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save for my two comments with quick resolutions. Everything looks great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggestions and questions:
source/model-data.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming there are more pages to come that will be nested here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, the indexes page will also go here
source/model-data/models.txt
Outdated
- | Stores an IPv4 or IPv6 address in string format. | ||
|
||
* - ``IntegerField`` | ||
- | Stores integer values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a size limit on this? I'm guessing 32 bits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 32 bits, I'll add that
source/model-data/models.txt
Outdated
Use Advanced Fields | ||
------------------- | ||
|
||
This section how to use the following field types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section how to use the following field types | |
This section describes how to use the following field types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops fixed
source/model-data/models.txt
Outdated
However, there is no way to distinguish between the SQL ``NULL`` and the JSON | ||
``null`` when querying. | ||
|
||
- Some queries that use ``Q`` objects might not return the expected results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a link or something we can provide that explains why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only place with more details is the skipped tests in the source code, but I'm not sure if that's useful to link to. I added a little more info (that this is mainly the case with the exclude() method)
source/model-data/models.txt
Outdated
MongoDB ``Object``. To learn more about this field, see the | ||
:ref:`django-models-embedded` section of this guide. | ||
|
||
{+django-odm+}'s support for ``JSONField`` has the following limitations: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I think this should be in a Limitations section that follows the Example (at the same level as the example).
- ``base_field``: Specifies the underlying data type of each value | ||
stored in the array. You cannot specify ``EmbeddedModelField`` or | ||
``FileField`` as the base field type. | ||
|
||
- ``size``: Specifies the maximum size of the array. This field is | ||
optional. | ||
|
||
- ``options``: Specifies Django field options. To view a list of | ||
available options, see `Field options <{+django-docs+}/ref/models/fields/#field-options>`__ | ||
in the {+framework+} documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I think you should format these like the Django Fields table above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since i'm only describing 2-3 arguments in this section + the next one, I think I will leave as is
- ``embedded_model``: Specifies the model class to store. | ||
|
||
- ``options``: Specifies Django field options. To view a list of | ||
available options, see `Field options <{+django-docs+}/ref/models/fields/#field-options>`__ | ||
in the {+framework+} documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Format like the Django fields table
.. important:: | ||
|
||
The ``makemigrations`` Django command does not detect changes to embedded | ||
models. If you make changes to the embedded model's class, the model | ||
stored in the ``EmbeddedModelField`` does not reflect the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you update the embedded model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no way to update the structure of the embedded document, according to the api docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
source/model-data/models.txt
Outdated
Define a Model | ||
-------------- | ||
|
||
To create an model that represents a MongoDB collection, add your model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To create a model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching!
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-46325
Staging Links
Self-Review Checklist