An extension to the Django web framework that provides database and form color fields to accept RGB encoded color in HEX and store it as 4 bytes int
An extension to the Django web framework that provides database and form color fields to accept RGB encoded color
in HEX and store it as 4 bytes int.
Why use it?
It saves up to 3 bytes for you!!! :)
The only loss is when you want to save color in packed form (i.e. you trying to save 'abc' (not '#abc'), which is 3 bytes but its int
representation is 4 bytes)
pip install django-rgbfield
No need to include 'rgbfield' to INSTALLED_APPS because it provides only fields and nothing more.
from django.db import models
from rgbfield.fields import RGBColorField
color = RGBColorField(default='#fff')
You can both generate form using ModelForm class or do it manually:
from django import forms
from rgbfield.fields import RGBColorFormField
color = RGBColorFormField(default='#fff')
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, Size & Hash SHA256 Hash Help||File Type||Python Version||Upload Date|
(5.5 kB) Copy SHA256 Hash SHA256
|Wheel||py2.py3||May 2, 2016|
(2.9 kB) Copy SHA256 Hash SHA256
|Source||None||May 2, 2016|