@@ -26,7 +26,7 @@ and delete functions on your model objects.
26
26
27
27
.. code-block:: bash
28
28
29
- python3 manage.py shell
29
+ python manage.py shell
30
30
31
31
.. step:: Import the required classes and modules
32
32
@@ -48,17 +48,14 @@ and delete functions on your model objects.
48
48
.. code-block:: python
49
49
50
50
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
+ )
62
59
63
60
.. step:: Update your movie object
64
61
@@ -79,16 +76,12 @@ and delete functions on your model objects.
79
76
a ``Viewer`` object that stores data about a movie viewer named ``"Abigail Carter"``:
80
77
81
78
.. 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:
88
79
89
- .. code-block:: python
90
-
91
- viewer.save()
80
+ viewer = Viewer.objects.create(
81
+ name="Abigail Carter",
82
+
83
+ password="secure123"
84
+ )
92
85
93
86
.. step:: Delete a viewer object
94
87
@@ -114,7 +107,7 @@ and delete functions on your model objects.
114
107
115
108
.. code-block:: bash
116
109
117
- python3 manage.py runserver
110
+ python manage.py runserver
118
111
119
112
.. step:: Render your new objects
120
113
0 commit comments