Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/nxt/master' into bug_fix2
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/docs/integrating-django-with-mongodb.md
  • Loading branch information
nesdis committed Apr 3, 2020
2 parents d895bce + 5d6d675 commit 0e1bb8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'your-db-name',
'HOST': 'your-db-host',
'CLIENT': {
'HOST': 'your-db-host',
}
}
}
```
Expand Down
13 changes: 12 additions & 1 deletion docs/docs/using-django-with-mongodb-data-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ class Entry(models.Model):
objects = models.DjongoManager()
```

```python
e = Entry.objects.create(
headline='h1',
blog=Blog(
name='b1',
tagline='t1'
)
)
g = Entry.objects.get(headline='h1')
assert e == g
```

## Embedded Form

While creating a Form for [the ModelForm](https://docs.djangoproject.com/en/dev/topics/forms/modelforms/), the embedded forms **are automatically generated**. Multiple embedded forms get automatically generated when the Model contains an array of embedded models. However, you can still override this by specifying the `model_form_class` argument in the `EmbeddedField`.
Expand Down Expand Up @@ -220,7 +232,6 @@ It is a good practice to **define embedded models as abstract models** and this

```python
from djongo import models
from django import forms

class Blog(models.Model):
name = models.CharField(max_length=100)
Expand Down

0 comments on commit 0e1bb8f

Please sign in to comment.