Login

Snippets by rfugger

Snippet List

Unlimited-length CharField

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. LongCharField is a way to avoid putting arbitrary max_length values where they aren't required. It will only work with databases that allow VARCHAR with no numeric parameters, such as Postgres. MySQL won't work.

  • text
  • field
  • postgres
  • charfield
  • length
  • max_length
  • unlimited
  • varchar
Read More

CheckboxSelectMultiple that renders in columns

This is a CheckboxSelectMultiple widget that will render its choices divided evenly into multiple ul elements that can be styled nicely into columns. Pass in a css class to the constructor to be assigned to the ul's. See also: http://code.djangoproject.com/ticket/9230

  • checkbox
  • columns
Read More

rfugger has posted 2 snippets.