Metadata-Version: 2.4
Name: django-hstore-widget
Version: 0.1.0
Summary: Human friendly HStoreWidget. Continual of django-admin-hstore-widget.
Project-URL: Homepage, https://github.com/baseplate-admin/django-hstore-widget
Project-URL: Repository, https://github.com/baseplate-admin/django-hstore-widget
Project-URL: Bug Tracker, https://github.com/baseplate-admin/django-hstore-widget/issues
Author-email: baseplate-admin <61817579+baseplate-admin@users.noreply.github.com>, Alexandre Dufour <adufour@poka.io>
Maintainer-email: baseplate-admin <61817579+baseplate-admin@users.noreply.github.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: django>=5.0
Description-Content-Type: text/markdown

# django-hstore-widget

> [!NOTE]  
> If you are new to `hstore`, please check [django-hstore-field](https://github.com/baseplate-admin/django-hstore-field). The package builds on top of this to give an ergonomic implementation.

[![Downloads](https://static.pepy.tech/badge/django-hstore-widget)](https://pepy.tech/project/django-hstore-widget) [![CI](https://github.com/baseplate-admin/django-hstore-widget/actions/workflows/CI.yml/badge.svg)](https://github.com/baseplate-admin/django-hstore-widget/actions/workflows/test.yml) [![Pypi Badge](https://img.shields.io/pypi/v/django-hstore-widget.svg)](https://pypi.org/project/django-hstore-widget/) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/baseplate-admin/django-hstore-widget/master.svg)](https://results.pre-commit.ci/latest/github/baseplate-admin/django-hstore-widget/master)

FormField that properly renders HStoreField Data in django Admin based on [`djangoauts package`](https://github.com/djangonauts/django-hstore) and an updated fork of [`django-admin-hstore-widget`](https://github.com/PokaInc/django-admin-hstore-widget)

## Requirements

- Python 3.10 and up
- Django 5.0 and up
- Modern browsers ( Chrome 112+, Firefox 117+, Safari 16.5+ )

Using pip:

```bash
pip install django-hstore-widget
```

## Installation

```python

# settings.py

INSTALLED_APPS = [
    ...,
    'django_hstore_widget',
    ...
]

```

## Usage

```python
# yourmodel/forms.py
from django import forms
from django_hstore_widget.forms import HStoreFormField
from .models import Yourmodel

class MyModelAdminForm(forms.ModelForm):
    my_hstore_field = HStoreFormField()

    class Meta:
       model = Yourmodel

# yourmodel/admin.py
from django.contrib import admin
from .models import Yourmodel
from .forms import MyModelAdminForm


@admin.register(Yourmodel)
class YourmodelAdmin(admin.ModelAdmin):
    form = MyModelAdminForm
```

## Result

![Rendered result](./assets/rendered.png)

## Comparison

### Vs `JSONB`

| Feature                           | `HStoreField` | `JSONField` |
| --------------------------------- | ------------- | ----------- |
| Requires PostgreSQL extension     | ✅            | ❌          |
| Flat key–value support            | ✅            | ✅          |
| Nested structure support          | ❌            | ✅          |
| Supports non-string values        | ❌            | ✅          |
| Simple key-value admin UI         | ✅            | ❌          |
| Easy validation                   | ✅            | ❌          |
| Advanced JSON queries             | ❌            | ✅          |
| Powerful containment queries      | ❌            | ✅          |
| Smaller storage footprint         | ✅            | ❌          |
| Suitable for metadata fields      | ✅            | ✅          |
| Suitable for structured documents | ❌            | ✅          |
