-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for converting Postgres fields
- Loading branch information
1 parent
a1dd2b6
commit 7f96500
Showing
4 changed files
with
59 additions
and
8 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,15 +1,24 @@ | ||
from django.db import models | ||
|
||
|
||
class MissingType(object): | ||
pass | ||
|
||
try: | ||
UUIDField = models.UUIDField | ||
except AttributeError: | ||
# Improved compatibility for Django 1.6 | ||
class UUIDField(object): | ||
pass | ||
UUIDField = MissingType | ||
|
||
try: | ||
from django.db.models.related import RelatedObject | ||
except: | ||
# Improved compatibility for Django 1.6 | ||
class RelatedObject(object): | ||
pass | ||
RelatedObject = MissingType | ||
|
||
|
||
try: | ||
# Postgres fields are only available in Django 1.8+ | ||
from django.contrib.postgres.fields import ArrayField, HStoreField, JSONField | ||
except ImportError: | ||
ArrayField, HStoreField, JSONField = (MissingType, ) * 3 |
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