A usefull and incredible Django application that allow you to use emoticons in your templates :)
Project description
Django-emoticons is a django application providing utilities to add emoticons in your templates. Pretty incredible no?
Install
Once you have installed the package in your PYTHON_PATH, register the emoticons app in your INSTALLED_APPS project’s section.
INSTALLED_APPS = ( ... 'emoticons', ... )
Usage
Filter Usage
For our example we will make a template who display the field content of a model, this field has this value:
Coding is fun and sexy :D
So in our templates we will load the emoticons_tags library and use the emoticons filter:
{% load emoticons_tags %} {{ object.content|emoticons }}
Which will render:
Coding is fun and sexy
Tag Usage
The emoticons app also provides a tag named emoticons for converting raw text.
{% load emoticons_tags %} {% emoticons %} Documenting is boring but usefull :p {% endemoticons %}
Which will render :
Documenting is boring but usefull
Index
If you want to retrieve a list of all availables emoticons you can use the emoticons_index tag.
{% load emoticons_tags %} {% emoticons_index as emoticons_list %} {% for emoticons in emoticons_list %} <p>{{ emoticons.0|emoticons }}: {{ emoticons|join:" " }}</p> {% endfor %}
Settings
You can use differents settings for customizing the application:
EMOTICONS_DIRECTORY
The directory where the emoticons files are located, use 'emoticons' as default.
EMOTICONS_LIST
The list of the emoticons used by the application, something like this:
(('(devil)', 'devil.gif'), ('(angel)', 'angel.gif'), ((':)', ':-)', ':=)', '(smile)'), 'smile.gif'), ((':(', ':-(', ':=(', '(sad)'), 'sadsmile.gif'), )
If the HTML code of the emoticons does not fit to your needs, you can override the 'emoticons/emoticon.html' template to adjust it.
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
Built Distribution
File details
Details for the file django-emoticons-1.1.tar.gz
.
File metadata
- Download URL: django-emoticons-1.1.tar.gz
- Upload date:
- Size: 117.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 353de2ccd65fb631028438520bced066e3b3efd64fc7b3a1fe85f10194077800 |
|
MD5 | 4cbf2171a8526551d16d7bc704698a0f |
|
BLAKE2b-256 | 87d57b6b37ef6c26368607555e2107ac05f710f5eda8ccd8d5b28b70f7bd3170 |
File details
Details for the file django_emoticons-1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_emoticons-1.1-py2.py3-none-any.whl
- Upload date:
- Size: 142.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ecc79ff92dbf5299243c07fdb442a7821f2564b8e1cedc4b71a9755fd3fd68 |
|
MD5 | cc049c80296fb1051db175818dc7f73e |
|
BLAKE2b-256 | f99318157712bbdcb661ca3ec7a59388a67dc21c402589a4dacc1fcc97031f7e |