Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A Django app which adds a ShortTextField model field, whichis like a TextField in the database but uses the TextInputrather than the Textarea widget in forms.

Project description

Short Text Field for Django

A very simple Django app that adds a ShortTextField model field class, which is treated like a TextField in the database (i.e. the data is stored in the database with the text rather than the varchar type, and the developer does not need to specify a max_length), but uses the TextInput widget (a single- line <input type="text>) by default rather than Textarea. This is ideal for PostgreSQL, which recommends the 'text' type in a wider variety of circumstances than other commonly-used database backends (see the PostgreSQL docs).


This package is available from PyPI, so you can install it using pip like this:

pip install django-short-text-field


  1. Add 'short_text_field' to your INSTALLED_APPS setting like this:

  2. Add a ShortTextField to a model like this:

    from short_text_field.models import ShortTextField
      class ExampleModel(models.Model):
            example_field = ShortTextField
  3. A model with a ShortTextField should be registered in the admin site using short_text_field.admin.ModelAdmin., short_text_field.admin.ModelAdmin)

    A subclass of this class will also work:

    class ExampleModelAdmin(short_text_field.admin.ModelAdmin):
        model = ExampleModel
        ..., ExampleModelAdmin)

    If you have a hierarchy of ModelAdmin subclasses, you can still incorporate short_text_field.admin.ModelAdmin easily as a mixin:

    class ExampleModelAdmin2(short_text_field.admin.ModelAdmin, ExampleModelAdmin1):
        model = ExampleModel
        ..., ExampleModelAdmin)

    You can also use a subclass of short_text_field.admin.AdminSite for the site, which will make short_text_field.admin.ModelAdmin the default ModelAdmin subclass to use for registering. In the simplest case, you can just set the default_site attribute of the AdminConfig class and then register all of your models in the normal way:

    from django.contrib.admin import apps
    import short_text_field.admin.AdminSite
    class ExampleAdminConfig(apps.AdminConfig):
        default_site = short_text_field.admin.AdminSite

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-short-text-field, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size django_short_text_field-0.3.2-py3-none-any.whl (7.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size django-short-text-field-0.3.2.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page