From 4e065e18c9ea276ab6eafd336e5367b318ced1da Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Tue, 20 Jun 2023 04:53:22 +0000 Subject: automatic import of python-django-jsoneditor-widget --- .gitignore | 1 + python-django-jsoneditor-widget.spec | 342 +++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 344 insertions(+) create mode 100644 python-django-jsoneditor-widget.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..6c7fc20 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/django-jsoneditor-widget-1.3.2.tar.gz diff --git a/python-django-jsoneditor-widget.spec b/python-django-jsoneditor-widget.spec new file mode 100644 index 0000000..c621a8e --- /dev/null +++ b/python-django-jsoneditor-widget.spec @@ -0,0 +1,342 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-jsoneditor-widget +Version: 1.3.2 +Release: 1 +Summary: Django form widget form JSONField +License: MIT +URL: https://github.com/arthurc0102/django-jsoneditor-widget +Source0: https://mirrors.aliyun.com/pypi/web/packages/e2/cd/d6784514c329bf96bc322304b173de071ae0f52070a588ce6e1832369dfd/django-jsoneditor-widget-1.3.2.tar.gz +BuildArch: noarch + + +%description +# django-jsoneditor-widget + +> Django form widget form JSONField + +## Demo + +It look like this. + +![demo image](https://github.com/arthurc0102/django-jsoneditor-widget/blob/master/screenshot/demo.png?raw=true) + +## Install + +- Install: `pip install django-jsoneditor-widget` +- Settings: + ```python + INSTALLED_APPS = [ + # some apps .... + 'jsoneditor', + # other apps ... + ] + ``` + +## Create model + +```python +from django.db import models +from django.contrib.postgres.fields import JSONField + + +class Book(models.Model): + name = models.CharField(max_length=150) + information = JSONField() + + def __str__(self): + return self.name +``` + +## Admin site settings + +- Use ModelAdmin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldModelAdmin + + from .models import Book + + + admin.site.register(Product, JSONFieldModelAdmin) + ``` + +- Use mixin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldAdminMixin + + from .models import Book + + + @admin.register(Book) + class BookModelAdmin(JSONFieldAdminMixin, admin.ModelAdmin): + pass + ``` + +- Use custom widget to specify jsoneditor options + ```python + from django.contrib import admin + from django.contrib.postgres.fields import JSONField + + from jsoneditor.forms import JSONEditor + + from .models import Book + + + class TextJSONEditor(JSONEditor): + jsoneditor_options = { + "mode": "text" + } + + + @admin.register(Book) + class BookModelAdmin(admin.ModelAdmin): + formfield_overrides = { + JSONField: {"widget": TextJSONEditor} + } + + ``` + + + + +%package -n python3-django-jsoneditor-widget +Summary: Django form widget form JSONField +Provides: python-django-jsoneditor-widget +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-jsoneditor-widget +# django-jsoneditor-widget + +> Django form widget form JSONField + +## Demo + +It look like this. + +![demo image](https://github.com/arthurc0102/django-jsoneditor-widget/blob/master/screenshot/demo.png?raw=true) + +## Install + +- Install: `pip install django-jsoneditor-widget` +- Settings: + ```python + INSTALLED_APPS = [ + # some apps .... + 'jsoneditor', + # other apps ... + ] + ``` + +## Create model + +```python +from django.db import models +from django.contrib.postgres.fields import JSONField + + +class Book(models.Model): + name = models.CharField(max_length=150) + information = JSONField() + + def __str__(self): + return self.name +``` + +## Admin site settings + +- Use ModelAdmin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldModelAdmin + + from .models import Book + + + admin.site.register(Product, JSONFieldModelAdmin) + ``` + +- Use mixin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldAdminMixin + + from .models import Book + + + @admin.register(Book) + class BookModelAdmin(JSONFieldAdminMixin, admin.ModelAdmin): + pass + ``` + +- Use custom widget to specify jsoneditor options + ```python + from django.contrib import admin + from django.contrib.postgres.fields import JSONField + + from jsoneditor.forms import JSONEditor + + from .models import Book + + + class TextJSONEditor(JSONEditor): + jsoneditor_options = { + "mode": "text" + } + + + @admin.register(Book) + class BookModelAdmin(admin.ModelAdmin): + formfield_overrides = { + JSONField: {"widget": TextJSONEditor} + } + + ``` + + + + +%package help +Summary: Development documents and examples for django-jsoneditor-widget +Provides: python3-django-jsoneditor-widget-doc +%description help +# django-jsoneditor-widget + +> Django form widget form JSONField + +## Demo + +It look like this. + +![demo image](https://github.com/arthurc0102/django-jsoneditor-widget/blob/master/screenshot/demo.png?raw=true) + +## Install + +- Install: `pip install django-jsoneditor-widget` +- Settings: + ```python + INSTALLED_APPS = [ + # some apps .... + 'jsoneditor', + # other apps ... + ] + ``` + +## Create model + +```python +from django.db import models +from django.contrib.postgres.fields import JSONField + + +class Book(models.Model): + name = models.CharField(max_length=150) + information = JSONField() + + def __str__(self): + return self.name +``` + +## Admin site settings + +- Use ModelAdmin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldModelAdmin + + from .models import Book + + + admin.site.register(Product, JSONFieldModelAdmin) + ``` + +- Use mixin + ```python + from django.contrib import admin + + from jsoneditor.admin import JSONFieldAdminMixin + + from .models import Book + + + @admin.register(Book) + class BookModelAdmin(JSONFieldAdminMixin, admin.ModelAdmin): + pass + ``` + +- Use custom widget to specify jsoneditor options + ```python + from django.contrib import admin + from django.contrib.postgres.fields import JSONField + + from jsoneditor.forms import JSONEditor + + from .models import Book + + + class TextJSONEditor(JSONEditor): + jsoneditor_options = { + "mode": "text" + } + + + @admin.register(Book) + class BookModelAdmin(admin.ModelAdmin): + formfield_overrides = { + JSONField: {"widget": TextJSONEditor} + } + + ``` + + + + +%prep +%autosetup -n django-jsoneditor-widget-1.3.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-jsoneditor-widget -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot - 1.3.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..f7460b2 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +1d1f345e05f1295067df73f0dcd70859 django-jsoneditor-widget-1.3.2.tar.gz -- cgit v1.2.3