19.3. Django Emoji Picker
19.3.1. Install
Install package:
$ python -m pip install django-emoji-picker
Append to myproject/settings.py
:
INSTALLED_APPS += ['emoji_picker']
19.3.2. Admin
Add to myproject/shop/admin.py
:
>>>
... from django.db import models
... from django.contrib import admin
... from emoji_picker.widgets import EmojiPickerTextInput, EmojiPickerTextarea
... from shop.models import Customer
...
...
... @admin.register(Customer)
... class CustomerAdmin(admin.ModelAdmin):
... formfield_overrides = {
... models.CharField: {'widget': EmojiPickerTextInput},
... models.TextField: {'widget': EmojiPickerTextarea},
... }
19.3.3. Forms
Add to myproject/shop/forms.py
:
from emoji_picker.widgets import EmojiPickerTextInputAdmin, EmojiPickerTextareaAdmin
class YourModelForm(forms.ModelForm):
short_text = forms.CharField(widget=EmojiPickerTextInputAdmin)
long_text = forms.CharField(widget=EmojiPickerTextareaAdmin)