Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobian/django-postgres-unlimited-varchar
A tiny app adding support unlimited varchar fields (no specified max length) in Django/Postgres.
https://github.com/jacobian/django-postgres-unlimited-varchar
django postgres postgresql
Last synced: 22 days ago
JSON representation
A tiny app adding support unlimited varchar fields (no specified max length) in Django/Postgres.
- Host: GitHub
- URL: https://github.com/jacobian/django-postgres-unlimited-varchar
- Owner: jacobian
- Created: 2018-11-07T22:20:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-14T15:01:32.000Z (about 2 years ago)
- Last Synced: 2024-07-25T04:32:57.056Z (3 months ago)
- Topics: django, postgres, postgresql
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 32
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
A tiny app adding support unlimited ``varchar`` fields (no specified max length) in Django/Postgres.
Usage::
from django.db import models
from django_postgres_unlimited_varchar import UnlimitedCharFieldclass Person(models.Model):
name = UnlimitedCharField()
...Why?
Out of the box, Django has two fields for text:
* ``CharField``, which is for single-line text, and has a required maximum length (the ``max_length`` argument). In the database, this creates a field of type ``varchar(LENGTH)``.
* ``TextField``, which is for multi-line text, and has no maximum length. In the database, this creates a field of type ``text``.Clearly missing is a third type: single-line, no max length. Postgres supports this as the ``varchar`` type (note the lack of a length).
This field adds that type. AFAIK there isn't any performance hit in using this, so it's suitable for any situation where there isn't a clear required max length.