djangosnippets.org: Latest snippets tagged with 'charfield'http://djangosnippets.org/tags/charfield/2019-05-05T10:59:12.887442-05:00StringField: CharField with no max_length for Postgres
2019-05-05T10:59:12.887442-05:00cdcarterhttp://djangosnippets.org/snippets/10667/<p>Django's CharField requires a max_length, and TextField displays a multi-
line widget, but in Postgres there's no reason to add an arbitrary max
thanks to the <code>varlena</code> storage format. So this is a TextField that
displays as a single line instead of a multiline TextArea.</p>
Freely redistributableUnlimited-length CharField
2011-01-19T03:33:48.718332-06:00rfuggerhttp://djangosnippets.org/snippets/2328/<p>Unlimited-length character fields in Postgres perform the same as limited-length fields, and the Postgres manual suggests not arbitrarily limiting these fields. Unfortunately, Django does not provide a way to access unlimited-length character fields except using TextField, which is rendered differently in forms and in the admin, and has different connotations. …</p>
Freely redistributable