Skip to main content

Expose JSONField data as a virtual django model fields.

Project description

IN ORDER TO REDUCE MAINTENANCE COST, THE PACKAGE FUNCTIONALITY WAS MOVED INTO THE django-viewflow

PLEASE, CONSIDE TO UPGRADE AND UPDATE IMPORTS:

…code::bash

$ pip install django-viewflow>=2.0.0b1

..code::python

from viewflow import jsonstore

Expose Django JSONField data as virtual model fields

Use ModelForm and ModelAdmin as usual. Perform simple queries. Migrate to real table columns when needed without code change.

Suitable to store dumb business data, quick prototypes without DB migrations, and replace multi-table inheritance joins.

https://img.shields.io/pypi/v/django-jsonstore.svg https://img.shields.io/pypi/pyversions/django-jsonstore.svg https://img.shields.io/pypi/djversions/django-jsonstore.svg

Use with caution! Replacing relational structures with JSON data should be mindfull architecture decision.

Works with any JSONField django.contrib.postgres, django-annoying, django-mysql, upcoming django Cross-db JSONField

Work in progress part of https://json-schema.org definitions are only supported.

Quick start

import jsonstore
from django import forms
from django.contrib import admin
from django.db import models
from .??. import JSONField

class Employee(models.Model):
    data = JSONField(default={})
    full_name = jsonstore.CharField(max_length=250)
    hire_date = jsonstore.DateField()
    salary = jsonstore.DecimalField(max_digits=10, decimal_places=2)

class EmployeeForm(forms.ModelForm):
    class Meta:
        model = Employee
        fields = ['full_name', 'hire_date', 'salary']

@admin.register(Employee)
class EmployeeAdmin(admin.ModelAdmin):
    list_display = ['full_name', 'hire_date']
    fields = ['full_name', ('hire_date', 'salary')]

Demo

The demo shows how to handle multiple User types within single table with JSONField and Django-Polymodels proxies.

$ export DATABASE_URL=postgresql://viewflow:viewflow@localhost/viewflow
$ export DJANGO_SETTINGS_MODULE=demo.settings
$ tox python manage.py migrate
$ tox python manage.py runserver

License

Django JSONStore is an Open Source project licensed under the terms of the AGPL license - The GNU Affero General Public License v3.0 with the Additional Permissions described in LICENSE_EXCEPTION

You can more read about AGPL at AGPL FAQ This package license scheme follows to GCC Runtime library licensing. If you use Linux already, probably this package license, should not bring anything new to your stack.

Latest changelog

0.5.1 2023-01-16

Package deprication on favor of django-viewflow

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-jsonstore-0.5.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

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

django_jsonstore-0.5.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file django-jsonstore-0.5.1.tar.gz.

File metadata

  • Download URL: django-jsonstore-0.5.1.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

File hashes

Hashes for django-jsonstore-0.5.1.tar.gz
Algorithm Hash digest
SHA256 fe49dd134b2c86ac434f77244be28102616783521c22de6d361879824b6d1a27
MD5 4217ad23bf3d17e0f3d7c6c2d535d13c
BLAKE2b-256 7b33ac3234c30bfb77daf87b128611fa9b3a834b370efb4270e97aa171864842

See more details on using hashes here.

File details

Details for the file django_jsonstore-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: django_jsonstore-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

File hashes

Hashes for django_jsonstore-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5aeeac300ee1b93ca26708fbf3fc48cf7b92aaff638ef05b80a59f70d23cfb79
MD5 f303ce47fd65e67303b5391954655ed7
BLAKE2b-256 2a5fe2f36b96da4baab8c96b535d564de8a5bb9d16f53447e6ce659d932b838f

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