Skip to main content

A None field for Django.

Project description

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.

PyPI Version Supported Python versions Build Status Documentation Status GPL-2.0-only OR LGPL-2.1-or-later Coverage


  • Django 1.8, 1.11, 2.0, 2.1, 2.2, 3.0.
  • Python 2.7, 3.5, 3.6, 3.7, 3.8


  1. Install latest stable version from PyPI:

    pip install django-nonefield

    Or latest stable version from GitHub:

    pip install

    Or latest stable version from BitBucket:

    pip install
  2. Add nonefield to INSTALLED_APPS of the your projects’ Django settings.

        # ...
        # None field
        # ...


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.

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.


GPL-2.0-only OR LGPL-2.1-or-later


For any issues contact me at the e-mail given in the Author section.


Artur Barseghyan <>

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-nonefield, version 0.4
Filename, size File type Python version Upload date Hashes
Filename, size django_nonefield-0.4-py3-none-any.whl (26.2 kB) File type Wheel Python version 3.8 Upload date Hashes View
Filename, size django-nonefield-0.4.tar.gz (19.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page