Icon Picker for admin panel In Django
Project description
Django Material Icon Picker Widget
How to start:
pip install django-material-icons
Include it in the settings (Installed apps):
INSTALLED_APPS = [
...
'django.contrib.staticfiles',
'icon_picker_widget', #<----
...
Add static path files of widget to settings.py:
STATICFILES_DIRS = [
('icon_picker_widget',os.path.join(BASE_DIR, 'icon_picker_widget/static'))
]
Example of Usage:
model.py:
from django.db import models
class BlogPost(models.Model):
name = models.TextField()
icon = models.TextField()
admin.py
from django import forms
from django.contrib import admin
from icon_picker_widget.widgets import IconPickerWidget
from .models import BlogPost
class BlogPostAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(BlogPostAdminForm, self).__init__(*args, **kwargs)
self.fields['icon'].widget = IconPickerWidget()
class BlogPostAdmin(admin.ModelAdmin):
form = BlogPostAdminForm
admin.site.register(BlogPost, BlogPostAdmin)
Acknowledgements
This widget wraps npick, a no-frills, no-fuss javascript icon picker.
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
File details
Details for the file django-material-icon-widget-0.1.2.tar.gz
.
File metadata
- Download URL: django-material-icon-widget-0.1.2.tar.gz
- Upload date:
- Size: 9.2 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.8.0 tqdm/4.26.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23c239c1c55ad8874120d7296fed2eaefb5078f9a7db25c59ed352b05e1d172f |
|
MD5 | 23de6322154306259b3b08f23e7fa54c |
|
BLAKE2b-256 | 88d90c8d4916ba7a08aceaf5e48bc2a08951ead34eb8066bb74276a5d55ba5f3 |
Provenance
File details
Details for the file django_material_icon_widget-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: django_material_icon_widget-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- 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.8.0 tqdm/4.26.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f49fb69502b2e5e403d3c3becabd1ce01f2974186cfd381c8ddf1c11c7c8ece |
|
MD5 | 67e8602f2b5228c78de6f6f061b2fa09 |
|
BLAKE2b-256 | 7a81a45345ca13d000f4f3d751482219a4ff1f9731b99d272dee0f1eb0565d94 |