@@ -49,10 +49,10 @@ DATABASES = {
49
49
[ ` MongoClient ` ] ( https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html ) .
50
50
51
51
In your Django settings, you must specify that all models should use
52
- ` MongoAutoField ` .
52
+ ` ObjectIdAutoField ` .
53
53
54
54
``` python
55
- DEFAULT_AUTO_FIELD = " django_mongodb.fields.MongoAutoField "
55
+ DEFAULT_AUTO_FIELD = " django_mongodb.fields.ObjectIdAutoField "
56
56
```
57
57
58
58
This won't override any apps that have an ` AppConfig ` that specifies
@@ -68,22 +68,22 @@ from django.contrib.contenttypes.apps import ContentTypesConfig
68
68
69
69
70
70
class MongoAdminConfig (AdminConfig ):
71
- default_auto_field = " django_mongodb.fields.MongoAutoField "
71
+ default_auto_field = " django_mongodb.fields.ObjectIdAutoField "
72
72
73
73
74
74
class MongoAuthConfig (AuthConfig ):
75
- default_auto_field = " django_mongodb.fields.MongoAutoField "
75
+ default_auto_field = " django_mongodb.fields.ObjectIdAutoField "
76
76
77
77
78
78
class MongoContentTypesConfig (ContentTypesConfig ):
79
- default_auto_field = " django_mongodb.fields.MongoAutoField "
79
+ default_auto_field = " django_mongodb.fields.ObjectIdAutoField "
80
80
```
81
81
82
82
Then replace each app reference in the ` INSTALLED_APPS ` setting with the new
83
83
`` AppConfig `` . For example, replace ` 'django.contrib.admin' ` with
84
84
` 'mysite.apps.MongoAdminConfig' ` .
85
85
86
- Because all models must use ` MongoAutoField ` , each third-party and contrib app
86
+ Because all models must use ` ObjectIdAutoField ` , each third-party and contrib app
87
87
you use needs to have its own migrations specific to MongoDB.
88
88
89
89
For example, you might configure your settings like this:
0 commit comments