semvec/pypi-packages huggingface dataset:
ruia-cache 0.0.2
ruia_cache - A Ruia plugin for caching URL.
License: MIT

# ruia-cache

A [Ruia](https://github.com/howie6879/ruia) plugin for caching URL

## Installation

```shell script
pip install -U ruia-cache

# New features
pip install git+https://github.com/python-ruia/ruia-cache
```

## Usage

`ruia-cache` will automatically cache the captured URL to prevent the second request to the target web page:

```python
import os

from ruia_cache import RuiaCacheSpider

# Set RUIA_CACHE path
os.environ.setdefault(
    "RUIA_CACHE", os.path.dirname(__file__),
)


class Demo(RuiaCacheSpider):
    name = "demo_spider"
    start_urls = ["http://httpbin.org/get"]

    async def parse(self, response):
        html = await response.text()
        print(html)


if __name__ == "__main__":
    Demo.start()
    # Using cache data
    Demo.start()
```

Enjoy it :)
django-jsoneditor-widget 1.3.2
Django form widget form JSONField
License: MIT

# 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}
        }

    ```