diff options
Diffstat (limited to 'python-django-better-admin-arrayfield.spec')
-rw-r--r-- | python-django-better-admin-arrayfield.spec | 639 |
1 files changed, 639 insertions, 0 deletions
diff --git a/python-django-better-admin-arrayfield.spec b/python-django-better-admin-arrayfield.spec new file mode 100644 index 0000000..c9dd6d9 --- /dev/null +++ b/python-django-better-admin-arrayfield.spec @@ -0,0 +1,639 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-better-admin-arrayfield +Version: 1.4.2 +Release: 1 +Summary: Better ArrayField widget for admin +License: MIT +URL: https://github.com/gradam/django-better-admin-arrayfield +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/35/4f/e8bdf86d5bba2622d585bec983a0b59f373f4ed00eb948a6907ba35e5585/django-better-admin-arrayfield-1.4.2.tar.gz +BuildArch: noarch + + +%description +# Django better admin ArrayField + +[](https://badge.fury.io/py/django-better-admin-arrayfield) + +[](https://github.com/gradam/django-better-admin-arrayfield/actions) + +[](https://codecov.io/gh/gradam/django-better-admin-arrayfield) + +Better ArrayField widget for admin + +Supported Python versions: [](https://www.python.org/downloads/release/python-350/) [](https://www.python.org/downloads/release/python-360/) [](https://www.python.org/downloads/release/python-370/) [](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: + + +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.2 (2020-12-08) + + - Adjust template to better match django style + +## 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. + + + + +%package -n python3-django-better-admin-arrayfield +Summary: Better ArrayField widget for admin +Provides: python-django-better-admin-arrayfield +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-better-admin-arrayfield +# Django better admin ArrayField + +[](https://badge.fury.io/py/django-better-admin-arrayfield) + +[](https://github.com/gradam/django-better-admin-arrayfield/actions) + +[](https://codecov.io/gh/gradam/django-better-admin-arrayfield) + +Better ArrayField widget for admin + +Supported Python versions: [](https://www.python.org/downloads/release/python-350/) [](https://www.python.org/downloads/release/python-360/) [](https://www.python.org/downloads/release/python-370/) [](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: + + +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.2 (2020-12-08) + + - Adjust template to better match django style + +## 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. + + + + +%package help +Summary: Development documents and examples for django-better-admin-arrayfield +Provides: python3-django-better-admin-arrayfield-doc +%description help +# Django better admin ArrayField + +[](https://badge.fury.io/py/django-better-admin-arrayfield) + +[](https://github.com/gradam/django-better-admin-arrayfield/actions) + +[](https://codecov.io/gh/gradam/django-better-admin-arrayfield) + +Better ArrayField widget for admin + +Supported Python versions: [](https://www.python.org/downloads/release/python-350/) [](https://www.python.org/downloads/release/python-360/) [](https://www.python.org/downloads/release/python-370/) [](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: + + +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.2 (2020-12-08) + + - Adjust template to better match django style + +## 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. + + + + +%prep +%autosetup -n django-better-admin-arrayfield-1.4.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-better-admin-arrayfield -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.4.2-1 +- Package Spec generated |