Coder Social home page Coder Social logo

husubeyli / django-colorfield Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabiocaccamo/django-colorfield

3.0 0.0 0.0 174 KB

color field for django models with a nice color-picker in the admin. :art:

License: MIT License

Python 90.49% HTML 5.56% JavaScript 3.95%

django-colorfield's Introduction

django-colorfield

simple color field for your models with a nice color-picker in the admin-interface.

django-colorfield-hex django-colorfield-hexa

Installation

  • Run pip install django-colorfield
  • Add colorfield to settings.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

django-colorfield-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. ๐ŸงŸโ€โ™‚๏ธ

django-colorfield's People

Contributors

fabiocaccamo avatar jaredly avatar gtnx avatar rcatajar avatar sdeleon28 avatar fetzig avatar matthewwithanm avatar scotteadams avatar pappacena avatar tomturner avatar sidneijp avatar murtys avatar michauds avatar matt-leach avatar romanosipenko avatar pauricthelodger avatar atodorov avatar zvolsky avatar selected-pixel-jameson avatar kilrogg avatar

Stargazers

Nizami Suleymanov avatar Yusif avatar Cavad Pashayev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.