simple color field for your models with a nice color-picker in the admin-interface.
Project description
django-colorfield
simple color field for your models with a nice color-picker in the admin-interface.
Installation
- Run
pip install django-colorfield
- Add
colorfield
tosettings.INSTALLED_APPS
- Run
python manage.py collectstatic
- Restart your application server
Usage
Settings
This package doesn't need any setting.
Models
Just add color field(s) to your models like this:
from colorfield.fields import ColorField
from django.db import models
class MyModel(model.Model):
color = ColorField(default='#FF0000')
Color Format
ColorField defaults to HEX format but also support HEXA. To set the format:
from colorfield.fields import ColorField
from django.db import models
class MyModel(model.Model):
color = ColorField(format='hexa')
Color Palette
You can provide a palette to choose from to the widget by using the field choices
from colorfield.fields import ColorField
from django.db import models
class MyModel(model.Model):
COLOR_CHOICES = [
("#FFFFFF", "white"),
("#000000", "black")
]
color = ColorField(choices=COLOR_CHOICES)
Admin
The admin will kindly provide a simple color picker for all color fields. :)
Testing
# create python virtual environment
virtualenv testing_django_colorfield
# activate virtualenv
cd testing_django_colorfield && . bin/activate
# clone repo
git clone https://github.com/fabiocaccamo/django-colorfield.git src && cd src
# install dev requirements
pip install -r requirements.txt
# run tests
tox
# or
python setup.py test
# or
python -m django test --settings "tests.settings"
Credits
Originally developed by Jared Forsyth
License
Released under MIT License.
See also
-
django-admin-interface
- the default admin interface made customizable by the admin itself. popup windows replaced by modals. 🧙 ⚡ -
django-extra-settings
- config and manage typed extra settings using just the django admin. ⚙️ -
django-maintenance-mode
- shows a 503 error page when maintenance-mode is on. 🚧 🛠️ -
django-redirects
- redirects with full control. ↪️ -
django-treenode
- probably the best abstract model / admin for your tree based stuff. 🌳 -
python-benedict
- dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘 -
python-codicefiscale
- encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳 -
python-fsutil
- file-system utilities for lazy devs. 🧟♂️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-colorfield-0.4.2.tar.gz
.
File metadata
- Download URL: django-colorfield-0.4.2.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5624a23e2fe97066f45e56eedf9672ab545aa5e52a790cfc33a5f29160a70684 |
|
MD5 | e5cda61debce1094f55135d8102b0b62 |
|
BLAKE2b-256 | 77596120325332a9efa5773cd56c2b34094e973faa33395325d8126eb7175248 |
File details
Details for the file django_colorfield-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: django_colorfield-0.4.2-py3-none-any.whl
- Upload date:
- Size: 46.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f907e11ed053b60d3316199446d76e889caeb27e980fe10cc2d8a825bc84e3a |
|
MD5 | 0a55ef0ddceb2f001b2f2222802a6291 |
|
BLAKE2b-256 | 828c4704b8ab9bae726d16632fa100a07a19475e2f4b4f8d32b6b77f2cd32cf4 |