Skip to main content

JSONField from django.contrib.postgres, but with a fallback to TextField

Project description

https://img.shields.io/pypi/v/django-jsonfallback.svg https://travis-ci.com/raphaelm/django-jsonfallback.svg?branch=master https://codecov.io/gh/raphaelm/django-jsonfallback/branch/master/graph/badge.svg

This is an extension to django.contrib.postgres.fields.JSONField, that works on other databases than PostgreSQL.

  • On MySQL and MariaDB, it uses the native JSON data type and supports most features.

  • On SQLite and all other databases, it just stores JSON strings in a text field and does not support querying.

This is tested against:

  • Python 3.4 to 3.6

  • Django 2.0 to 2.1

  • MySQL 5.7

  • MariaDB 10.3

  • PostgreSQL 9.4

  • SQLite (no querying funcationality)

Usage

Just use our drop-in replacement for JSONField:

from django.db import models
from jsonfallback.fields import FallbackJSONField


class Book(models.Model):
    data = FallbackJSONField()

    def __str__(self):
        return str(self.data['title'])

License

The code in this repository is published under the terms of the Apache License. See the LICENSE file for the complete license text.

This project is maintained by Raphael Michel <mail@raphaelmichel.de>. See the AUTHORS file for a list of all the awesome folks who contributed to this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-jsonfallback-2.1.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_jsonfallback-2.1.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file django-jsonfallback-2.1.2.tar.gz.

File metadata

  • Download URL: django-jsonfallback-2.1.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for django-jsonfallback-2.1.2.tar.gz
Algorithm Hash digest
SHA256 0132c655e422e382a8a6b0d11319f5655e25fa6eb225ad10c0a05584c5fa1a0e
MD5 5041c67c5127507f48eab462224944d6
BLAKE2b-256 616676401cb44b2a1882db71764709f93b324a5e36b8d53b7359c75766e5e0a8

See more details on using hashes here.

File details

Details for the file django_jsonfallback-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: django_jsonfallback-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for django_jsonfallback-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab17e6d854924b419a6bec7d98ca01f30e043c63ee560f6eaa7f5ab73324e85b
MD5 e2df262fd92cf1ccf4736b2aaf7866d0
BLAKE2b-256 19c44f2257e015ecfa4310ef0ac1a045f4ba31a847eae4ff9c3d1ac23a69cf3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page