Skip to content

Commit 924788d

Browse files
committed
edits
1 parent 4230372 commit 924788d

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

source/interact-data/crud.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ methods:
3939
`QuerySet API reference <https://docs.djangoproject.com/en/5.1/ref/models/querysets/>`__
4040
in the Django documentation.
4141

42+
You can also use the Django admin site to edit your models
43+
and their corresponding collections on a web interface. For
44+
more information, see `The Django admin site <https://docs.djangoproject.com/en/5.1/ref/contrib/admin/>`__
45+
in the Django documentation.
46+
4247
Sample Data
4348
~~~~~~~~~~~
4449

@@ -67,9 +72,17 @@ The ``Movie`` model class has the following definition:
6772
def __str__(self):
6873
return self.title
6974

75+
You can use the Python interactive shell to run the code examples.
76+
To enter the shell, run the following command from your project's
77+
root directory:
78+
79+
.. code-block:: bash
80+
81+
python3 manage.py shell
82+
7083
To learn how to create a Django application that uses the ``Movie``
71-
model to interact with MongoDB documents, visit the :ref:`django-get-started`
72-
tutorial.
84+
model and the Python interactive shell to interact with MongoDB documents,
85+
visit the :ref:`django-get-started` tutorial.
7386

7487
.. _django-crud-insert:
7588

@@ -81,7 +94,7 @@ model objects that represent the collection. Pass the new document's fields
8194
and values as arguments to the ``create()`` method.
8295

8396
Example
84-
```````
97+
~~~~~~~
8598

8699
The following example calls the ``create()`` method on your ``Movie`` objects
87100
to insert a document into the ``sample_mflix.movies`` collection. The new
@@ -90,9 +103,9 @@ of ``141``:
90103

91104
.. code-block:: python
92105

93-
from sample_mflix.models import Movie
106+
from sample_mflix.models import Movie
94107

95-
movie = Movie.objects.create(title="Poor Things", runtime=141)
108+
movie = Movie.objects.create(title="Poor Things", runtime=141)
96109

97110
.. note::
98111

@@ -118,7 +131,7 @@ that matches your query.
118131
``get()`` method, see the Specify a Query guide.
119132

120133
Example
121-
```````
134+
~~~~~~~
122135

123136
The following example calls the ``filter()`` method on your ``Movie`` objects
124137
to retrieve documents from the ``sample_mflix.movies`` collection. The query
@@ -158,7 +171,7 @@ or criteria that specifies which documents to update, as an argument to the
158171
arguments to the ``update()`` method.
159172

160173
Example
161-
```````
174+
~~~~~~~
162175

163176
The following example calls the ``update()`` method on your ``Movie`` objects
164177
to modify documents in the ``sample_mflix.movies`` collection. The code matches
@@ -194,7 +207,7 @@ or criteria that specifies which documents to delete, as an argument to the
194207
``filter()`` method.
195208

196209
Example
197-
```````
210+
~~~~~~~
198211

199212
The following example calls the ``delete()`` method on your ``Movie`` objects
200213
to delete documents in the ``sample_mflix.movies`` collection. The code matches
@@ -215,7 +228,7 @@ and deletes documents that have a ``runtime`` value of ``5``:
215228
:visible: false
216229

217230
// Outputs the number of deleted documents and objects
218-
16
231+
(16, {'sample_mflix.Movie': 16})
219232

220233

221234
Additional Information
@@ -227,4 +240,4 @@ To view more create, read, update, and delete examples, see the following
227240
steps of the :ref:`django-get-started` tutorial:
228241

229242
- :ref:`django-get-started-write`
230-
- :ref:`django-get-started-read`
243+
- :ref:`django-get-started-query`

0 commit comments

Comments
 (0)