File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
source/django-get-started Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -77,27 +77,30 @@ Create an Application
77
77
78
78
.. code-block:: bash
79
79
80
- python manage.py migrate
80
+ python3 manage.py migrate
81
81
82
- .. step:: Create models for movie and users data
82
+ .. step:: Create models for movie and user data
83
83
84
84
Open the ``models.py`` file in the ``sample_mflix`` directory and replace
85
85
its contents with the following code:
86
86
87
87
.. code-block:: python
88
88
89
+ import datetime
90
+
89
91
from django.db import models
90
92
91
93
92
94
class Movies(models.Model):
93
- name = models.CharField(max_length=200)
95
+ title = models.CharField(max_length=200)
96
+ plot = models.CharField(max_length=800)
94
97
runtime = models.IntegerField(default=0)
95
-
98
+ released = models.DateTimeField("release date", null=True)
96
99
97
100
class Users(models.Model):
98
- name = models.CharField(max_length=200 )
101
+ name = models.CharField(max_length=100 )
99
102
email = models.CharField(max_length=200)
100
-
103
+ password = models.CharField(max_length=100)
101
104
102
105
.. step:: Include your app in your project
103
106
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ Write Data to MongoDB
30
30
.. code-block:: python
31
31
32
32
from sample_mflix.models import Movies, Users
33
- parasite = Movies(name ="Parasite", runtime=132)
33
+ parasite = Movies(title ="Parasite", runtime=132)
34
34
parasite.save()
35
35
36
- This code inserts a movie with a ``name `` value of ``"Parasite"`` into
36
+ This code inserts a movie with a ``title `` value of ``"Parasite"`` into
37
37
the ``sample_mflix`` MongoDB database.
You can’t perform that action at this time.
0 commit comments