Skip to content

Commit 58b3541

Browse files
committed
TG feedback 2
1 parent 1c06aec commit 58b3541

9 files changed

+40
-46
lines changed

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
2626
driver-short = "PyMongo"
2727
driver-long = "PyMongo, the MongoDB synchronous Python driver,"
2828
driver-async = "PyMongo Async"
29-
django-odm = "MongoDB Backend for Django"
29+
django-odm = "Django MongoDB Backend"
3030
django-api = "https://django-mongodb.readthedocs.io/en/latest/"
3131
language = "Python"
3232
mdb-server = "MongoDB Server"

source/django-get-started.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ Get Started with {+django-odm+}
3030
Create an Admin Site </django-get-started/django-create-admin/>
3131
Next Steps </django-get-started/django-next-steps/>
3232

33-
{+django-odm+} is a PyMongo integration that allows you to use the
34-
MongoDB document model in your Django application. This tutorial shows
35-
you how to create a Django app, connect to MongoDB cluster hosted on
36-
MongoDB Atlas, and interact with data in your cluster.
33+
{+django-odm+} is a Django database backend that uses PyMongo to connect
34+
to MongoDB. This tutorial shows you how to create a Django app, connect to
35+
a MongoDB cluster hosted on MongoDB Atlas, and interact with data in your cluster.
3736

3837
.. tip::
3938

source/django-get-started/django-connect-mongodb.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ you can create a Django project that connects to MongoDB.
6161
Open your ``settings.py`` file and navigate to the ``DATABASES`` setting.
6262
Replace this setting with the following code:
6363

64-
.. code-block:: bash
64+
.. code-block:: python
6565

6666
DATABASES = {
6767
"default": django_mongodb_backend.parse_uri("<connection string URI>"),
@@ -79,7 +79,7 @@ you can create a Django project that connects to MongoDB.
7979

8080
.. code-block:: bash
8181

82-
python3 manage.py runserver
82+
python manage.py runserver
8383

8484
Then, visit http://127.0.0.1:8000/. This page displays a "Congratulations!"
8585
message and an image of a rocket.

source/django-get-started/django-connection-string.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ To connect to an instance or deployment not hosted on Atlas, see
6666
mongodb+srv://<username>:<password>@cluster0.example.mongodb.net/sample_mflix?retryWrites=true&w=majority
6767

6868
After completing these steps, you have a connection string that
69-
contains your database username, database password, and database name.
70-
69+
contains your database username, database password, and database name.

source/django-get-started/django-create-admin.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ in the Django documentation.
2929

3030
.. code-block:: bash
3131

32-
python3 manage.py createsuperuser
32+
python manage.py createsuperuser
3333

3434
Then, your terminal prompts you for a username, email address,
3535
and password. For each prompt, enter the following information
@@ -51,7 +51,7 @@ in the Django documentation.
5151

5252
.. code-block:: bash
5353

54-
python3 manage.py runserver
54+
python manage.py runserver
5555

5656
Once your server is running, visit the http://127.0.0.1:8000/admin/
5757
URL to see the admin site. This site displays the following login

source/django-get-started/django-create-app.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
3131

3232
.. code-block:: bash
3333

34-
python3 manage.py startapp sample_mflix --template https://github.com/mongodb-labs/django-mongodb-app/archive/refs/heads/{+django-version-number+}.x.zip
34+
python manage.py startapp sample_mflix --template https://github.com/mongodb-labs/django-mongodb-app/archive/refs/heads/{+django-version-number+}.x.zip
3535

3636
.. note:: App Template
3737

@@ -58,6 +58,7 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
5858

5959
class Meta:
6060
db_table = "movies"
61+
managed = False
6162

6263
def __str__(self):
6364
return self.title
@@ -67,13 +68,17 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
6768
nominations = models.IntegerField(default=0)
6869
text = models.CharField(max_length=100)
6970

71+
class Meta:
72+
managed = False
73+
7074
class Viewer(models.Model):
7175
name = models.CharField(max_length=100)
7276
email = models.CharField(max_length=200)
7377
password = models.CharField(max_length=100)
7478

7579
class Meta:
7680
db_table = "users"
81+
managed = False
7782

7883
def __str__(self):
7984
return self.name
@@ -153,7 +158,7 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
153158
``templates``. Then, create a file called ``recent_movies.html``
154159
and paste the following code:
155160

156-
.. code-block:: python
161+
.. code-block:: html
157162

158163
<!-- templates/recent_movies.html -->
159164
<!DOCTYPE html>
@@ -182,7 +187,7 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
182187
Create another file in the ``sample_mflix/templates`` directory called
183188
``viewers_list.html`` and paste the following code:
184189

185-
.. code-block:: python
190+
.. code-block:: html
186191

187192
<!-- templates/viewers_list.html -->
188193
<!DOCTYPE html>
@@ -244,8 +249,8 @@ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Data
244249

245250
.. code-block:: bash
246251

247-
python3 manage.py makemigrations sample_mflix
248-
python3 manage.py migrate
252+
python manage.py makemigrations sample_mflix
253+
python manage.py migrate
249254

250255
After completing these steps, you have a basic {+django-odm+} app that
251256
you can use to access the ``sample_mflix`` Atlas database.

source/django-get-started/django-install.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ in your development environment.
3434

3535
.. code-block:: bash
3636

37-
python3 -m venv venv
37+
python -m venv venv
3838
source venv/bin/activate
3939

4040
.. tab:: Windows
4141
:tabid: windows-venv
4242

4343
.. code-block:: bash
4444

45-
python3 -m venv venv
45+
python -m venv venv
4646
. venv\Scripts\activate
4747

4848
.. tip::
4949

5050
In the preceding commands, you might need to replace
51-
``python3`` with the command that points to your Python
51+
``python`` with the command that points to your Python
5252
3.10+ interpreter.
5353

5454
.. step:: Install {+django-odm+}
@@ -63,9 +63,7 @@ in your development environment.
6363
This command also installs the following dependencies:
6464

6565
- PyMongo version {+version-number+} and its dependencies
66-
- Django version {+django-version-number+} and its dependencies
66+
- Latest Django {+django-version-number+}.x version and its dependencies
6767

6868
After you complete these steps, you have {+django-odm+} and its
69-
dependencies installed in your development environment.
70-
71-
69+
dependencies installed in your development environment.

source/django-get-started/django-query-data.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ to read data from the ``sample_mflix`` database.
2323

2424
.. code-block:: bash
2525

26-
python3 manage.py shell
26+
python manage.py shell
2727

2828
Then, run the following code to query the
2929
``sample_mflix.users`` collection for a movie viewer whose email is

source/django-get-started/django-write-data.txt

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ and delete functions on your model objects.
2626

2727
.. code-block:: bash
2828

29-
python3 manage.py shell
29+
python manage.py shell
3030

3131
.. step:: Import the required classes and modules
3232

@@ -48,17 +48,14 @@ and delete functions on your model objects.
4848
.. code-block:: python
4949

5050
movie_awards = Award(wins=122, nominations=245, text="Won 1 Oscar")
51-
movie = Movie(title="Minari", plot=
52-
"A Korean-American family moves to an Arkansas farm in search of their own American Dream",
53-
runtime=217, released=timezone.make_aware(datetime(2020, 1, 26, 0, 0)),
54-
awards=movie_awards, genres=["Drama", "Comedy"])
55-
56-
Save the object to store its data as a document in the ``movies``
57-
collection, as shown in the following code:
58-
59-
.. code-block:: python
60-
61-
movie.save()
51+
movie = Movie.objects.create(
52+
title="Minari",
53+
plot="A Korean-American family moves to an Arkansas farm in search of their own American Dream",
54+
runtime=217,
55+
released=timezone.make_aware(datetime(2020, 1, 26)),
56+
awards=movie_awards,
57+
genres=["Drama", "Comedy"]
58+
)
6259

6360
.. step:: Update your movie object
6461

@@ -79,16 +76,12 @@ and delete functions on your model objects.
7976
a ``Viewer`` object that stores data about a movie viewer named ``"Abigail Carter"``:
8077

8178
.. code-block:: python
82-
83-
viewer = Viewer(name="Abigail Carter", email="[email protected]",
84-
password="secure123")
85-
86-
Save the object to store its data as a document in the ``users``
87-
collection, as shown in the following code:
8879

89-
.. code-block:: python
90-
91-
viewer.save()
80+
viewer = Viewer.objects.create(
81+
name="Abigail Carter",
82+
83+
password="secure123"
84+
)
9285

9386
.. step:: Delete a viewer object
9487

@@ -114,7 +107,7 @@ and delete functions on your model objects.
114107

115108
.. code-block:: bash
116109

117-
python3 manage.py runserver
110+
python manage.py runserver
118111

119112
.. step:: Render your new objects
120113

0 commit comments

Comments
 (0)