-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
128d9ac
commit 1ebb982
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# django-admin-hstore-widget | ||
|
||
FormField that properly render HStoreField Data in django Admin based on [`djangoauts package`](https://github.com/djangonauts/django-hstore) and updated fork of [`django-admin-hstore-widget`](https://github.com/PokaInc/django-admin-hstore-widget) | ||
|
||
## Requirements | ||
|
||
- Python 3.9 and Up ( well technically any python version from 3.6 should work ) | ||
- Django 3.2 and Up | ||
|
||
Using pip: | ||
|
||
```bash | ||
pip install django-admin-hstore-widget-2 | ||
``` | ||
|
||
## Installation | ||
|
||
```python | ||
|
||
# settings.py | ||
|
||
INSTALLED_APPS = [ | ||
..., | ||
'django_admin_hstore_widget', | ||
... | ||
] | ||
|
||
``` | ||
|
||
## Usage | ||
|
||
```python | ||
# yourmodel/admin.py | ||
from django.contrib import admin | ||
from django import forms | ||
|
||
from django_admin_hstore_widget.forms import HStoreFormField | ||
from models import Yourmodel | ||
|
||
class MyModelAdminForm(forms.ModelForm): | ||
my_hstore_field = HStoreFormField() | ||
|
||
class Meta: | ||
model = Yourmodel | ||
exclude = () | ||
|
||
@admin.register(Yourmodel) | ||
class YourmodelAdmin(admin.ModelAdmin): | ||
form = MyModelAdminForm | ||
|
||
``` | ||
|
||
## Result | ||
|
||
![Rendered result](./assets/rendered.png) |