Skip to main content

Better string field for Django.

Project description

A field intended for strings that typically has a length less than 500 characters. django-stringfield tries to not to enforce length on database level if possible but different databases have different limitations. Currently implemented as:

PostgreSQL

character varying

MySQL

VARCHAR (65528) [1]

Oracle

VARCHAR2 (4000)

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 500

  • 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.

Source Distribution

django-stringfield-0.2.3.tar.gz (4.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page