Skip to main content

Color fields for Django models and forms using HTML5 native color type input elements

Project description

Color fields for forms and models using HTML5’s native input element of type color.

Quickstart

Install django-colorinput and add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    
    'colorinput.apps.ColorInputConfig',
    
)

Now you can use ColorField in your models:

from django.db import models

from colorinput.models import ColorField

class MyModel(models.Model):
    
    color = ColorField(default="d0d0d0")
    

In forms, the color field will be displayed using HTML5’s native color type input element. In your own templates, you could use the value stored in the field like this:

<span style="color: #{{ object.color }}">

… or however you want, really. Just keep in mind that the value is stored as RGB in triple HEX format without the leading “#” (hash symbol).

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-colorinput-0.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

django_colorinput-0.2-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file django-colorinput-0.2.tar.gz.

File metadata

  • Download URL: django-colorinput-0.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for django-colorinput-0.2.tar.gz
Algorithm Hash digest
SHA256 aa558987a1aecb230a448b19955a5d7856edcc03c9b3b25253b9a204e9bef377
MD5 0ed08a7059d7f7808c57c4289a4f7912
BLAKE2b-256 ef1811559ed18f4c644da61e66e73dd083e302ebcdd6341788391717479b9769

See more details on using hashes here.

File details

Details for the file django_colorinput-0.2-py3-none-any.whl.

File metadata

  • Download URL: django_colorinput-0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for django_colorinput-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9b1dacedda44f556365cfcdd618d80049498cfdcf41d37bd15543ba1d1b973e
MD5 97259a33d2b5de8c9a73653a7b43bd1e
BLAKE2b-256 be617e4558e4772fbe10a79283e2f089f457e9dc41cf5d1471ddf0ea167fcd10

See more details on using hashes here.

Supported by

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