forked from doableware/djongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented List Field and Dict Field
- Loading branch information
Showing
10 changed files
with
105 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
from django.db.models import * | ||
from django.db.models import __all__ as models_all | ||
|
||
from .fields import ( | ||
ArrayModelField, ListField, DjongoManager, | ||
EmbeddedModelField, ArrayReferenceField, ObjectIdField, | ||
GenericObjectIdField | ||
GenericObjectIdField, DictField | ||
) | ||
#from .json import JSONField | ||
from django.db.models import __all__ as models_all | ||
|
||
__all__ = models_all + [ | ||
'DjongoManager', 'ListField', 'ArrayModelField', | ||
'EmbeddedModelField', 'ArrayReferenceField', 'ObjectIdField', | ||
'GenericObjectIdField', 'DictField' | ||
] |
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
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,19 @@ | ||
from djongo import models | ||
|
||
|
||
class ListEntry(models.Model): | ||
_id = models.ObjectIdField() | ||
headline = models.CharField(max_length=255) | ||
authors = models.ListField() | ||
|
||
def __str__(self): | ||
return self.headline | ||
|
||
class DictEntry(models.Model): | ||
_id = models.ObjectIdField() | ||
headline = models.CharField(max_length=255) | ||
blog = models.DictField() | ||
|
||
def __str__(self): | ||
return self.headline | ||
|
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from django.test import TestCase as DjangoTestCase | ||
from logging import getLogger, StreamHandler | ||
|
||
from django.test import TestCase as DjangoTestCase | ||
|
||
|
||
class TestCase(DjangoTestCase): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
root_logger = getLogger() | ||
root_logger.addHandler(StreamHandler()) | ||
super().setUpClass() | ||
if not root_logger.hasHandlers(): | ||
root_logger.addHandler(StreamHandler()) |
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
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
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