Better ArrayField widget for admin
Project description
Django better admin ArrayField
Better ArrayField widget for admin
Supported Django versions: 1.11, 2.0, 2.1, 2.2, 3.0
might work with different django/python versions as well but I did not test that.
It changes comma separated widget to list based in admin panel.
Before:
After:
Quickstart
Install Django better admin ArrayField:
pip install django-better-admin-arrayfield
Add it to your `INSTALLED_APPS`:
INSTALLED_APPS = (
...
'django_better_admin_arrayfield',
...
)
Usage
django_better_admin_arrayfield.models.fields.ArrayField
is a drop-in replacement for standard Django ArrayField
.
Import it like below and use it in your model class definition.
from django_better_admin_arrayfield.models.fields import ArrayField
Import DynamicArrayMixin like below
from django_better_admin_arrayfield.admin.mixins import DynamicArrayMixin
In your admin class add DynamicArrayMixin
:
...
class MyModelAdmin(admin.ModelAdmin, DynamicArrayMixin):
That's it.
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Pre-commit hooks
Install pre-commit black hook
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_dev.txt
(myenv) $ pre-commit install
Credits
Inspired by: https://stackoverflow.com/a/49370480/4638248
Tools used in rendering this package:
History
1.2.0 (2020-07-09)
- handle default values in model fields
1.1.0 (2020-04-28)
- Add spanish translations
1.0.7 (2020-04-27)
- Add possibility to i18n strings
1.0.6 (2020-04-15)
- Remove debugging print statements
- use default_app_config for easier integration
- Support dynamically-added inline forms
1.0.5 (2019-12-30)
- Add python 3.8 and Django 3.0 to tests
1.0.4 (2019-09-02)
- Can add item after removing everything from the list
1.0.3 (2019-09-02)
- Can add item after removing everything from the list
- Do not call static at startup time
1.0.2 (2019-04-03)
- If field is required empty list raises ValidationError on clean.
1.0.1 (2019-02-23)
- Empty list is no longer recognized as changed.
1.0.0 (2019-02-21)
- First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-better-admin-arrayfield-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b013300c6786bd51dd3a7aee2a1185c8b98f93b1fb937fda60fe94f2339cc0a9 |
|
MD5 | fd24c5bb9d4eceb7668e9f2b57bc1834 |
|
BLAKE2b-256 | aabf6052828003bb6977b7871f3566147230b1b2bdaeb66e6e85f830d1a2c453 |
Hashes for django_better_admin_arrayfield-1.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed81b2d0c3e388706a79b5aff62431d731ee247a18cf00e1c1c98de3ae174e4a |
|
MD5 | d22cf84f5d304ab2d488015653ddae94 |
|
BLAKE2b-256 | f8d0e08865c3f5ad654100a421c33cc90449abd1b9c5ca4ef00e285724422085 |