Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

JSONField with fallback for Django

UNMAINTAINED

This library is no longer maintained since Django now includes this functionality natively. You do not need any upgrade steps, you can just replace all your FallbackJSONField usages with JSONField including in your old migrations.

https://travis-ci.com/raphaelm/django-jsonfallback.svg?branch=master

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.7
  • Django 2.0 to 2.2
  • MySQL 5.7 (only on Django 2.1+)
  • 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.

About

Use PostgreSQL's and MySQL's JSONField, but fall back to a TextField implementation on other databases

Resources

License

Packages

No packages published