-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
331 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from django.apps.registry import Apps | ||
from django.db import models | ||
|
||
from django_mongodb.fields import EmbeddedModelField | ||
|
||
# Because we want to test creation and deletion of these as separate things, | ||
# these models are all inserted into a separate Apps so the main test | ||
# runner doesn't migrate them. | ||
|
||
new_apps = Apps() | ||
|
||
|
||
class Address(models.Model): | ||
city = models.CharField(max_length=20) | ||
state = models.CharField(max_length=2) | ||
zip_code = models.IntegerField(db_index=True) | ||
uid = models.IntegerField(unique=True) | ||
unique_together_one = models.CharField(max_length=10) | ||
unique_together_two = models.CharField(max_length=10) | ||
|
||
class Meta: | ||
apps = new_apps | ||
unique_together = [("unique_together_one", "unique_together_two")] | ||
|
||
|
||
class Author(models.Model): | ||
name = models.CharField(max_length=10) | ||
age = models.IntegerField(db_index=True) | ||
address = EmbeddedModelField(Address) | ||
employee_id = models.IntegerField(unique=True) | ||
unique_together_three = models.CharField(max_length=10) | ||
unique_together_four = models.CharField(max_length=10) | ||
|
||
class Meta: | ||
apps = new_apps | ||
unique_together = [("unique_together_three", "unique_together_four")] | ||
|
||
|
||
class Book(models.Model): | ||
name = models.CharField(max_length=100) | ||
author = EmbeddedModelField(Author) | ||
|
||
class Meta: | ||
apps = new_apps |
Oops, something went wrong.