PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/README.rst

https://github.com/BenAtWide/django-smileys
ReStructuredText | 100 lines | 74 code | 26 blank | 0 comment | 0 complexity | 5f94793f404ea41e6c3315fe360826bb MD5 | raw file
  1. ``django-smileys`` is an application that allows your Django-powered site to
  2. display those annoying and useless smileys whenever the ``smileys`` filter a
  3. pattern that you specify. This application serves a very simple purpose, but
  4. its uses can go beyond that of merely inserting smileys whenever a particular
  5. pattern (like ":)" or ";)"). It can replace whatever pattern you want with an
  6. image of your choosing. There's gotta be something useful in that, right?
  7. This application can make your blog, forums, photo galleries, user comments,
  8. etc a little more interesting, and it's very simple to install. Free icon sets
  9. plague the Internet, and you can choose whatever icons you'd like to use!
  10. Features
  11. ========
  12. * Strict pattern matching: you can specify very strict patterns for your
  13. smileys
  14. * Regular expression pattern matching: if you need a little more power in your
  15. pattern matching capabilities, you can specify that your patterns are regular
  16. expressions (on a per-smiley basis) and the filter should know what to do.
  17. Requirements
  18. ============
  19. This application was built on Django 1.0.2, and it should work with any version
  20. of Django that uses the ``admin.site.register`` method for telling the Django
  21. admin that a model should appear in the admin (as opposed to the ``class
  22. Admin:`` method).
  23. Installation
  24. ============
  25. Download ``django-smileys`` using *one* of the following methods:
  26. easy_install or pip
  27. -------------------
  28. You can download the package from the `CheeseShop
  29. <http://pypi.python.org/pypi/django-smileys/>`_ or use one of the following
  30. commands::
  31. easy_install django-smileys
  32. pip install -U django-smileys
  33. to download and install ``django-smileys``.
  34. Clone From Version Control
  35. --------------------------
  36. You can grab the latest copy of the source code by cloning the project from one
  37. of these official repositories::
  38. hg clone http://bitbucket.org/codekoala/django-smileys
  39. git clone http://github.com/codekoala/django-smileys.git
  40. hg clone http://django-smileys.googlecode.com/hg django-smileys
  41. Package Download
  42. ----------------
  43. Download the latest ``.tar.gz`` file from the downloads section and extract it
  44. somewhere you'll remember.
  45. Configuration
  46. =============
  47. First of all, you must add this project to your list of ``INSTALLED_APPS`` in
  48. ``settings.py``::
  49. INSTALLED_APPS = (
  50. 'django.contrib.admin',
  51. 'django.contrib.auth',
  52. 'django.contrib.contenttypes',
  53. 'django.contrib.sessions',
  54. 'django.contrib.sites',
  55. ...
  56. 'smileys',
  57. ...
  58. )
  59. Run ``manage.py syncdb``. This creates a the table in your database that is
  60. necessary for operation.
  61. Usage
  62. =====
  63. Open the template file that you want to have your smileys appear in and make
  64. sure it has something like this in it::
  65. {% load smiley_tags %}
  66. {% block content %}
  67. {{ some_content_var|smileys }}
  68. {% endblock %}
  69. The ``smiley_tags`` library provides you with a ``smileys`` filter, which will
  70. examine your database for all active smileys. It then runs though
  71. ``some_content_var`` (in this example) and replaces the patterns it finds with
  72. the respective smileys. More recent versions also contain a
  73. ``textile_smileys`` tag for users of Textile formatting. Pretty simple huh!
  74. And useless! w00t.