Metadata-Version: 2.1
Name: django-better-admin-arrayfield
Version: 1.4.1
Summary: Better ArrayField widget for admin
Home-page: https://github.com/gradam/django-better-admin-arrayfield
Author: Jakub Semik
Author-email: kuba.semik@gmail.com
License: MIT
Description: # Django better admin ArrayField
        
        [![image](https://badge.fury.io/py/django-better-admin-arrayfield.svg)](https://badge.fury.io/py/django-better-admin-arrayfield)
        
        [![Actions Status](https://github.com/gradam/django-better-admin-arrayfield/workflows/tests/badge.svg)](https://github.com/gradam/django-better-admin-arrayfield/actions)
        
        [![image](https://codecov.io/gh/gradam/django-better-admin-arrayfield/branch/master/graph/badge.svg)](https://codecov.io/gh/gradam/django-better-admin-arrayfield)
        
        Better ArrayField widget for admin
        
        Supported Python versions: [![Python 3.5](https://img.shields.io/badge/python-3.5-blue.svg)](https://www.python.org/downloads/release/python-350/) [![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/) [![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/) [![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
        
        
        
        
        
        Supported Django versions: 2.0, 2.1, 2.2, 3.0, 3.1
        
        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:
        ![Alt text](https://raw.githubusercontent.com/gradam/django-better-admin-arrayfield/master/readme_images/before.jpg "Before")
        
        After:
        ![Alt text](https://raw.githubusercontent.com/gradam/django-better-admin-arrayfield/master/readme_images/after.png "After")
        
        ## Quickstart
        
        Install Django better admin ArrayField:
        
            pip install django-better-admin-arrayfield
        
        Add it to your \`INSTALLED\_APPS\`:
        
        ```python
        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.
        ```python
        from django_better_admin_arrayfield.models.fields import ArrayField
        ```
        
        Import DynamicArrayMixin like below
        ```python
        from django_better_admin_arrayfield.admin.mixins import DynamicArrayMixin
        ```
        
        In your admin class add `DynamicArrayMixin`:
            ...
        ```python
        class MyModelAdmin(admin.ModelAdmin, DynamicArrayMixin):
        ```
        
        That's it.
        
        
        ### Custom subwidget
        
        By default the subwidget (the one used for each item in the array) will be TextInput. If you want something else, you can use your own specifying it in the `formfield_overrides` of your Admin model:
        ```python
        class MyWidget(DynamicArrayWidget):
            def __init__(self, *args, **kwargs):
                kwargs['subwidget_form'] = MyForm
                super().__init__(*args, **kwargs)
        
        class MyModelAdmin(models.ModelAdmin, DynamicArrayMixin):
            ...
            formfield_overrides = {
                DynamicArrayField: {'widget': MyWidget},
            }
        ```
        
        If you wanted to have Textarea as the subwidget, you can simply use the included drop-in widget replacement:
        ```python
        from django_better_admin_arrayfield.forms.widgets import DynamicArrayTextareaWidget
        
        class MyModelAdmin(models.ModelAdmin, DynamicArrayMixin):
            ...
            formfield_overrides = {
                DynamicArrayField: {'widget': DynamicArrayTextareaWidget},
            }
        ```
        
        ## 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:
        
          - [Cookiecutter](https://github.com/audreyr/cookiecutter)
          - [cookiecutter-djangopackage](https://github.com/pydanny/cookiecutter-djangopackage)
        
        
        # History
        
        ## 1.4.1 (2020-12-08)
        
          - Allow submitting empty array field
        
        ## 1.4.0 (2020-10-04)
        
          - allow choosing subwidget for DynamicArrayWidget
        
        ## 1.3.0 (2020-07-09)
        
          - Handle default values in form field
        
        ## 1.2.1 (2020-07-09)
        
          - Fix tests requirements
        
        ## 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.
        
Keywords: django-better-admin-arrayfield
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 2.1
Classifier: Framework :: Django :: 2.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
