An easy to use postgres hstore field that is based on django-hstore-widget
- Python 3.9 and Up ( well technically any python version from 3.6 should work )
- Django 3.2 and Up
- Modern browsers ( Chrome 112+, Firefox 117+, Safari 16.5+ or any browsers supporting css nesting )
pip install django-hstore-fieldInclude django-hstore-widget in your settings.py's INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
...,
'django_hstore_widget',
...
]Include django-hstore-widget's migration to any of your model's migration:
# Generated migration file
from django.db import migrations, models
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
("django_hstore_widget", "__latest__"),
]
operations = [
...
]and then use it:
# yourapp/models.py
from django.db import models
from django_hstore_field import HStoreField
class ExampleModel(models.Model):
data = HStoreField()Check the cats directory
Note
If you want a lower level implementation, please check django-hstore-widget.