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
Project description
django-rgbfield
=====================
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)
Installation
-------
Python package:
```
pip install django-rgbfield
```
No need to include 'rgbfield' to INSTALLED_APPS because it provides only fields and nothing more.
Usage
-------
```python
from django.db import models
from rgbfield.fields import RGBColorField
class ExampleModel(models.Model):
color = RGBColorField(default='#fff')
```
You can both generate form using ModelForm class or do it manually:
```python
from django import forms
from rgbfield.fields import RGBColorFormField
class ExampleForm(forms.Form):
color = RGBColorFormField(default='#fff')
```
=====================
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)
Installation
-------
Python package:
```
pip install django-rgbfield
```
No need to include 'rgbfield' to INSTALLED_APPS because it provides only fields and nothing more.
Usage
-------
```python
from django.db import models
from rgbfield.fields import RGBColorField
class ExampleModel(models.Model):
color = RGBColorField(default='#fff')
```
You can both generate form using ModelForm class or do it manually:
```python
from django import forms
from rgbfield.fields import RGBColorFormField
class ExampleForm(forms.Form):
color = RGBColorFormField(default='#fff')
```
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django_rgbfield-1.0-py2.py3-none-any.whl (5.5 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size django-rgbfield-1.0.tar.gz (2.9 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for django_rgbfield-1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 714f4d002d82941c685860e0875af4e39e043458374dfd1b9247948ba024b666 |
|
MD5 | 2025b08b8ec3a1168e98061c629d578c |
|
BLAKE2-256 | 06edf7a75d42998af87a76dd8063a13aa2f9f8594810240eadaf37174547ff07 |