django-nonefield is a None field for Django.
A typical use case: allow presentational (non-input, non-field) form elements (text, image, embed video, etc). This could be very useful if your forms are dynamic (as in form-builders/generators). Django REST Framework integration is implemented as well.
Prerequisites
Django 1.8, 1.11, 2.0, 2.1, 2.2, 3.0.
Python 2.7, 3.5, 3.6, 3.7, 3.8
Installation
Install latest stable version from PyPI:
pip install django-nonefieldOr latest stable version from GitHub:
pip install https://github.com/barseghyanartur/django-nonefield/archive/stable.tar.gzOr latest stable version from BitBucket:
pip install https://bitbucket.org/barseghyanartur/django-fobi/get/stable.tar.gzAdd nonefield to INSTALLED_APPS of the your projects’ Django settings.
INSTALLED_APPS = ( # ... # None field 'nonefield', # ... )
Usage
forms.py
In forms you could use it as follows:
from django import forms
from nonefield.fields import NoneField
class MyForm(forms.Form):
name = forms.CharField(max_length=255)
some_text = NoneField(initial='Lorem ipsum')
See this snippet as an example of how to allow to use paragraphs in the django-forms-builder.
serializers.py
You can also use it in Django REST Framework.
from rest_framework import serializers
from nonefield.contrib.drf_integration.fields import NoneField
class ContentTextField(NoneField):
"""Content text field."""
class BarSerializer(serializers.Serializer):
title = serializers.CharField(max_length=256)
text = serializers.CharField()
context_text = ContentTextField(label='', default='Haha')
See how it’s used in django-fobi to allow to use content/presentational elements (text, image, embed video, etc.) in the Django REST Framework schema.
Examples
License
GPL-2.0-only OR LGPL-2.1-or-later
Support
For any issues contact me at the e-mail given in the Author section.
Release files for django-nonefield 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-nonefield-0.4.tar.gz | 19.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_nonefield-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.9 kB
Release files / django-nonefield-0.4.tar.gz
| Download URL | django-nonefield-0.4.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1dff8437d69aacff5fcb0ef09a1a5c61f4ff64c150cdb0d55f0933c148a323f
|
|
BLAKE2b-256 checksum How to use checksums |
b7e41e81d6cc11165c094dcc2d41e6a98a45fe63ce0a55a5093413f993dacaa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.8
|
Release files / django_nonefield-0.4-py3-none-any.whl
| Download URL | django_nonefield-0.4-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
201073020461eac0ba92e5364b51184552265d940715c7b79227a5a011441b14
|
|
BLAKE2b-256 checksum How to use checksums |
2274e81a869ebd4138858f4337f30bc7c86c323b358d8db1e4dbe90a1ad79bf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.8
|