Skip to content

FutureMind/django-better-admin-arrayfield

 
 

Repository files navigation

Django better admin ArrayField

image

image

image

Better ArrayField widget for admin

Supported Python versions: 3.5, 3.6, 3.7 Supported Django versions: 1.11, 2.0, 2.1, 2.2

It changes comma separated widget to list based in admin panel.

Before: Alt text

After: Alt text

Quickstart

Install Django better admin ArrayField:

pip install django-better-admin-arrayfield

Add it to your `INSTALLED_APPS`:

INSTALLED_APPS = (
    ...
    'django_better_admin_arrayfield.apps.DjangoBetterAdminArrayfieldConfig',
    ...
)

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:

About

Better widget for Django ArrayField in admin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 67.7%
  • Makefile 12.7%
  • JavaScript 11.9%
  • CSS 4.5%
  • HTML 3.2%