A ColorField to save and filter by radius Colors in RGB array in postgresql.
Project description
Django Postgresql ColorField
Inspired by Utsob Roy(Codesign)[https://gitlab.com/codesigntheory/django-postgresql-rgb-colorfield]
Requirements
- Python 3.X
- Postgresql database in django.
Installation
pip install django-pg-colorfield
Quick start
- Add colorfield to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'colorfield',
]
- Import and Use ColorField:
To get search features you have to add ColorManager with your model.
from django.db import models
from colorfield_lib.colorfield import fields
class ColorManager(fields.ColorManager, models.Manager):
# You can put your queryset staff
pass
class ColorModel(models.Model):
color = fields.ColorField(null=True, blank=True)
objects = ColorManager()
- Filtering field.
- field="color" filed that you want to search.
- You can also pass as color="[1, 100, 200]" ro color="#0164C8".
- radius=10 is a margin you consider to search.
queryset = ColorModel.objects.by_radius(
...
field="color",
color=[1, 100, 200],
radius=10,
)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-pg-colorfield-1.0.tar.gz.
File metadata
- Download URL: django-pg-colorfield-1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a7a013fe3d5425639f8282563b85043819b1fc65bb304574ba4502b2b785fa8
|
|
| MD5 |
db4ff62c309e5096e927679a42857d71
|
|
| BLAKE2b-256 |
348c5da6239504c4f9a6603fce3a0211f692f5e61450f1918130deffb94eab28
|
File details
Details for the file django_pg_colorfield-1.0-py3-none-any.whl.
File metadata
- Download URL: django_pg_colorfield-1.0-py3-none-any.whl
- Upload date:
- Size: 4.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/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95bfa05ff31f23e21d5fbc3260433a6794808c10dbe680e722e5c8cad2721e9f
|
|
| MD5 |
6dc73f5e8fce8d21faab3adc42b5bbb3
|
|
| BLAKE2b-256 |
89320624115490f445e1b403f8155f9924b8033c529b75ee14d0a6b72282b073
|