Skip to main content

A simple Django form field widget to display a text field with the current word count.

Project description

Countable Field is a simple Django custom for widget for displaying a text area with the current word count displayed underneath. It can be set up to display the count in red when the current word count is out of required minimum or maximum word count for the form field.

Quick start

  1. Add “countable_field” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'countable_field',
    ]

2. In the form, set the field’s widget to be “CountableWidget”, passing the minimum and maximum word count as additional parameters, such as:

self.fields['essay_response'].widget = \
            CountableWidget(attrs={'data-min-count': this.essay_min_length,
                                   'data-max-count': this.essay_max_length})

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

coa-django-countable-field-1.5.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file coa-django-countable-field-1.5.tar.gz.

File metadata

  • Download URL: coa-django-countable-field-1.5.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for coa-django-countable-field-1.5.tar.gz
Algorithm Hash digest
SHA256 4c3c50e5fd9b78a9d3f43f27f870d181c94046f4184a86c1947e4e3701acb671
MD5 49526ab36a5def19b8e5cef29cc69ea0
BLAKE2b-256 ac1e7d6a3f96606f3dcc9827df32cc1bf76efe0c8d2bd1abc37e00e820c531d3

See more details on using hashes here.

Supported by

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