Skip to main content

Better string field for Django.

Project description

A string field that tries not to enforce length on database level. Currently implemented as:

PostgreSQL
character varying
MySQL
VARCHAR (65528) MySQL >= 5.0.3 should be able to handle a maximum length of 65535 but that does not work in my empirical testing using mysql 5.1.41 where 65528 is the maximum considering NULL and NOT NULL.
SQLite & Other backends
TEXT

Installation

pip install django-stringfield

Usage

You use this just like the normal django.db.models.CharField except that the key word argument max_length works a little differently:

  • It is optional and defaults to 255
  • It only enforces max length on the default formfield not on the database.

Example:

# models.py
from stringfield import StringField

class MyModel(models.Model):
    name = StringField()

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-stringfield, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django-stringfield-0.1.2.tar.gz (3.2 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