https://github.com/null-none/django-yaml-field
Same as Django JSONField but represent it as YAML (internally stores as JSON)
https://github.com/null-none/django-yaml-field
django django-application yaml yml
Last synced: 8 months ago
JSON representation
Same as Django JSONField but represent it as YAML (internally stores as JSON)
- Host: GitHub
- URL: https://github.com/null-none/django-yaml-field
- Owner: null-none
- License: mit
- Created: 2021-06-04T10:29:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-19T09:44:04.000Z (8 months ago)
- Last Synced: 2025-08-22T04:36:22.238Z (8 months ago)
- Topics: django, django-application, yaml, yml
- Language: Python
- Homepage:
- Size: 59.6 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-yaml-field
Same as Django JSONField but represent it as YAML (internally stores as JSON)
### Pip install
```bash
pip install django-yaml-field
```
### Example
```python
from django.db import models
from django_yaml_field import YAMLField
class ModelName(models.Model):
yaml = YAMLField()
```
Allows querying the stored data using lookups in the same way described in Django [documentation](https://docs.djangoproject.com/en/4.0/topics/db/queries/#querying-jsonfield)
### Syntax Highlight
If you want a nice syntax highlight in form, you can use with [django-ace](https://github.com/django-ace/django-ace)
```python
from django_ace import AceWidget
@admin.register(ModelName)
class ModelName(admin.ModelAdmin):
formfield_overrides = {YAMLField: {"widget": AceWidget(mode="yaml")}}
```
### License
MIT