@@ -59,28 +59,29 @@ The ``Movie`` model class has the following definition:
59
59
from django_mongodb_backend.fields import EmbeddedModelField, ArrayField
60
60
from django_mongodb_backend.managers import MongoManager
61
61
62
- class Movie(models.Model):
63
- title = models.CharField(max_length=200)
64
- plot = models.TextField(null=True)
65
- runtime = models.IntegerField(default=0)
66
- released = models.DateTimeField("release date", null=True)
67
- awards = EmbeddedModelField(Award)
68
- genres = ArrayField(models.CharField(max_length=100), blank=True)
69
- objects = MongoManager()
70
-
71
- class Meta:
72
- db_table = "movies"
73
-
74
- def __str__(self):
75
- return self.title
62
+ class Movie(models.Model):
63
+ title = models.CharField(max_length=200)
64
+ plot = models.TextField(blank=True)
65
+ runtime = models.IntegerField(default=0)
66
+ released = models.DateTimeField("release date", null=True, blank=True)
67
+ awards = EmbeddedModelField(Award)
68
+ genres = ArrayField(models.CharField(max_length=100), null=True, blank=True)
69
+ objects = MongoManager()
70
+
71
+ class Meta:
72
+ db_table = "movies"
73
+ managed = False
74
+
75
+ def __str__(self):
76
+ return self.title
76
77
77
78
You can use the Python interactive shell to run the code examples.
78
79
To enter the shell, run the following command from your project's
79
80
root directory:
80
81
81
82
.. code-block:: bash
82
83
83
- python3 manage.py shell
84
+ python manage.py shell
84
85
85
86
To learn how to create a Django application that uses the ``Movie``
86
87
model and the Python interactive shell to interact with MongoDB documents,
0 commit comments