Skip to main content

Django Pick material Icon Widget

Project description

Django Pick material Icon Widget

Install

pip install django-npick

Usage

add templates path admin/change_form.html extra the default admin template to use js css

# project/settings.py
from django-npick import TEMPLATE_PATH   # 1

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [TEMPLATE_PATH],  # add templates path # 2
        'APP_DIRS': True,
        'OPTIONS': {)
    },
]

start an app

python manage.py startapp app

define your model

from django.db import models


class Icon(models.Model):
    name = models.CharField(max_length=30)

Add IconWidget to form then add form to Admin.

# app/admin.py
django.contrib import admin
from django import forms
from django_npick import IconWidget  # 3

from .models import Bingo


class BingoForm(forms.ModelForm):
    name = forms.CharField(widget=IconWidget)  # 4


class BingoAdmin(admin.ModelAdmin):
    form = BingoForm
    fields = ['name']

admin.site.register(Bingo, BingoAdmin)

runserver

python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-npick-0.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

django_npick-0.0.1-py3.6.egg (21.6 kB view details)

Uploaded Source

File details

Details for the file django-npick-0.0.1.tar.gz.

File metadata

  • Download URL: django-npick-0.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for django-npick-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dc3009ca21b1232dd16ebd9c0de4a6dd286f29e9d490ad2128eaa898410d58b9
MD5 68fb57b88bdab6c284da8338198b1437
BLAKE2b-256 17b896c0b9f047f08a514476f6724b2f9391fe80bf905f7903bddf464a9237b3

See more details on using hashes here.

File details

Details for the file django_npick-0.0.1-py3.6.egg.

File metadata

  • Download URL: django_npick-0.0.1-py3.6.egg
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for django_npick-0.0.1-py3.6.egg
Algorithm Hash digest
SHA256 d691357ff92c1eb4ab42926abd2b47ec5aa4820b8e2da4031e2cb5a8f4fc52cd
MD5 b87ec015f66348302ca1ece294c08d94
BLAKE2b-256 16aaf2f49065d9a49f0c154cc7ee157a594321f3f711ad4b12e427d7bbbb1c65

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page