{ "info": { "author": "Dmitry Voronin", "author_email": "dimka665@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=========================\ndjango-markitup-field\n=========================\n\nAn implementation of a custom MarkupField for Django. A MarkupField is in\nessence a TextField with an associated markup format and `MarkItUp!`_ markup\neditor widget with AJAX preview. The field also caches its rendered value on\nthe assumption that disk space is cheaper than CPU cycles in a web application.\n\nBased on `django-markupfield `_\nand `django-markitup `_.\n\n.. _MarkItUp!: http://markitup.jaysalvat.com/\n\nInstallation\n============\n\nThe recommended way to install django-markitup-field is with\n`pip `_\n\nInstall from PyPI with ``easy_install`` or ``pip``::\n\n pip install django-markitup-field\n\nor get the `in-development version`_::\n\n pip install django-markitup-field==tip\n\n.. _in-development version: http://github.com/dimka665/django-markitup-field\n\nIt is not necessary to add ``'markitup_field'`` to your ``INSTALLED_APPS``, it\nmerely needs to be on your ``PYTHONPATH``.\n\nIf you want to use AJAX-based preview, add\n``url(r'^markitup/', include('markitup.urls'))`` in your root URLconf.\n\nRequirements\n------------\n\ndjango-markitup-field depends on a relatively current version of Django\n(tested with 1.3-1.4, may work with 1.2 but not guaranteed) and libraries for\nwhichever markup options you wish to include.\n\n\nSettings\n========\n\nYou can define the ``MARKUP_FILTERS`` setting, a mapping of strings\nto callables that 'render' a markup type::\n\n import markdown\n from docutils.core import publish_parts\n\n def render_rest(markup):\n parts = publish_parts(source=markup, writer_name=\"html4css1\")\n return parts[\"fragment\"]\n\n MARKUP_FILTERS = (\n ('markdown', markdown.markdown),\n ('restructuredtext', render_rest),\n )\n\nIf you do not define a ``MARKUP_FILTERS`` then one is provided with the\nfollowing markup types available:\n\nhtml:\n allows HTML, potentially unsafe\ntext:\n plain text markup, calls urlize and replaces text with linebreaks\nmarkdown:\n default `markdown`_ renderer (only if `python-markdown`_ is installed)\nrestructuredtext:\n default `ReST`_ renderer (only if `docutils`_ is installed)\ntextile:\n default `textile`_ renderer (only if `textile`_ is installed)\n\n.. _`markdown`: http://daringfireball.net/projects/markdown/\n.. _`ReST`: http://docutils.sourceforge.net/rst.html\n.. _`textile`: http://hobix.com/textile/quick.html\n.. _`python-markdown`: http://www.freewisdom.org/projects/python-markdown/\n.. _`docutils`: http://docutils.sourceforge.net/\n.. _`python-textile`: http://pypi.python.org/pypi/textile\n\nUsage\n=====\n\nUsing MarkupField is relatively easy, it can be used in any model definition::\n\n from django.db import models\n from markitup_field.fields import MarkupField\n\n class Article(models.Model):\n title = models.CharField(max_length=100)\n slug = models.SlugField(max_length=100)\n body = MarkupField()\n\n``Article`` objects can then be created with any markup type defined in\n``MARKUP_FORMATS``::\n\n Article.objects.create(title='some article', slug='some-article',\n body='*fancy*', body_markup_format='markdown')\n\nYou will notice that a field named ``body_markup_format`` exists that you did\nnot declare, MarkupField actually creates two extra fields. ``body_markup_format``\nThis field is always named according to the name of the declared ``MarkupField``.\n\nArguments\n---------\n\n``MarkupField`` also takes three optional arguments. Either\n``default_markup_format`` and ``markup_format`` arguments may be specified but\nnot both.\n\n``default_markup_format``:\n Set a markup_type that the field will default to if one is not specified.\n It is still possible to edit the markup type attribute and it will appear\n by default in ModelForms.\n\n``markup_format``:\n Set markup type that the field will always use, ``editable=False`` is set\n on the hidden field so it is not shown in ModelForms.\n\n``markup_choices``:\n A replacement list of markup choices to be used in lieu of\n ``MARKUP_FORMATS`` on a per-field basis.\n\n``escape_html``:\n A flag (False by default) indicating that the input should be regarded\n as untrusted and as such will be run through Django's ``escape`` filter.\n\n``rendered_field_name``:\n Name for field with rendered content. If it is set to None,\n then it named _rendered\n\n\nExamples\n~~~~~~~~\n\n``MarkupField`` that will default to using markdown but allow the user a choice::\n\n MarkupField(default_markup_type='markdown')\n\n``MarkupField`` that will use textile and not provide a choice on forms::\n\n MarkupField(markup_type='textile')\n\n``MarkupField`` that will use a custom set of renderers::\n\n CUSTOM_RENDERERS = (\n ('markdown', markdown.markdown),\n ('wiki', my_wiki_render_func)\n )\n MarkupField(markup_choices=CUSTOM_RENDERERS)\n\nAccessing a MarkupField on a model\n----------------------------------\n\nWhen accessing an attribute of a model that was declared as a ``MarkupField``\na special ``Markup`` object is returned. The ``Markup`` object has three\nparameters:\n\n``raw``:\n The unrendered markup.\n``markup_format``:\n The markup type.\n``rendered``:\n The rendered HTML version of ``raw``, this attribute is read-only.\n\nThis object has a ``__unicode__`` method that calls\n``django.utils.safestring.mark_safe`` on ``rendered`` allowing MarkupField\nobjects to appear in templates as their rendered selfs without any template\ntag or having to access ``rendered`` directly.\n\nAssuming the ``Article`` model above::\n\n >>> a = Article.objects.all()[0]\n >>> a.body.raw\n u'*fancy*'\n >>> a.body.markup_type\n u'markdown'\n >>> a.body.rendered\n u'

fancy

'\n >>> print unicode(a.body)\n

fancy

\n\nAssignment to ``a.body`` is equivalent to assignment to ``a.body.raw`` and\nassignment to ``a.body_markup_format`` is equivalent to assignment to\n``a.body.markup_format``.\n\n.. note::\n a.body.rendered is only updated when a.save() is called", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/dimka665/django-markitup-field/", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-markitup-field", "package_url": "https://pypi.org/project/django-markitup-field/", "platform": "any", "project_url": "https://pypi.org/project/django-markitup-field/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/dimka665/django-markitup-field/" }, "release_url": "https://pypi.org/project/django-markitup-field/1.2.10/", "requires_dist": null, "requires_python": null, "summary": "Custom Django field for easy use of markup in text fields", "version": "1.2.10" }, "last_serial": 790043, "releases": { "1.2-dev": [ { "comment_text": "", "digests": { "md5": "c419f8d81f278025cca4d24cc9c57ea7", "sha256": "e9e628e3b94d5608533ccf12a4c0ae58bb4f4d63bd07dd9345384acf5070704e" }, "downloads": -1, "filename": "django-markitup-field-1.2-dev.zip", "has_sig": false, "md5_digest": "c419f8d81f278025cca4d24cc9c57ea7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174745, "upload_time": "2012-12-21T01:39:44", "url": "https://files.pythonhosted.org/packages/82/3b/6def21fac637fe8b6db9581c2a2763609e1275434d295c324dad94e3ab89/django-markitup-field-1.2-dev.zip" } ], "1.2.1-dev": [ { "comment_text": "", "digests": { "md5": "29ab823b3d00a4f5c24ede79a03ac510", "sha256": "1c1bdf96c5c0b0b3d16e9be4c044cbacb950db0303b1c34e054083479997f46f" }, "downloads": -1, "filename": "django-markitup-field-1.2.1-dev.zip", "has_sig": false, "md5_digest": "29ab823b3d00a4f5c24ede79a03ac510", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174170, "upload_time": "2012-12-21T02:05:41", "url": "https://files.pythonhosted.org/packages/4e/3c/00aecdac89e2559ca744c5dff06219f693f18ddb95479defbff636a3215c/django-markitup-field-1.2.1-dev.zip" } ], "1.2.10": [ { "comment_text": "", "digests": { "md5": "0a1e055ba712c1f7a7fd3dea1a38a794", "sha256": "6face93299180375a3c4512b0831638d7ed8caccb2c2363ee141f66d95b26772" }, "downloads": -1, "filename": "django-markitup-field-1.2.10.zip", "has_sig": false, "md5_digest": "0a1e055ba712c1f7a7fd3dea1a38a794", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 173622, "upload_time": "2012-12-29T19:19:47", "url": "https://files.pythonhosted.org/packages/2b/3f/bd9b9a1e74fdab96fab42fca106676c72c0e66a674adcab41e0793375df1/django-markitup-field-1.2.10.zip" } ], "1.2.2-dev": [ { "comment_text": "", "digests": { "md5": "f5c0febb38a90b77a40445156d51688f", "sha256": "90aa7a294e69ffd651a4fcb697d56ee84900eb89008dee4684255b806d25ab23" }, "downloads": -1, "filename": "django-markitup-field-1.2.2-dev.zip", "has_sig": false, "md5_digest": "f5c0febb38a90b77a40445156d51688f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174171, "upload_time": "2012-12-21T02:19:31", "url": "https://files.pythonhosted.org/packages/71/7c/10dc17952cf3f949d9154e07897f2c15c121c93b94b380b490a1b2a93fa0/django-markitup-field-1.2.2-dev.zip" } ], "1.2.3-dev": [ { "comment_text": "", "digests": { "md5": "4cb3f60f6b8b066e11bd423fbfc1ab1b", "sha256": "697bea3173097423bb4edb07f531181143f4221750ac83f1eb1479616fbc75bd" }, "downloads": -1, "filename": "django-markitup-field-1.2.3-dev.zip", "has_sig": false, "md5_digest": "4cb3f60f6b8b066e11bd423fbfc1ab1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174196, "upload_time": "2012-12-29T17:31:44", "url": "https://files.pythonhosted.org/packages/e2/0a/1383af4a6e46c49b072a1f2d255b23d315d835a6e272772c9180f35ea65e/django-markitup-field-1.2.3-dev.zip" } ], "1.2.4-dev": [ { "comment_text": "", "digests": { "md5": "c7bc35c7af143bcbc212cad55e9250b9", "sha256": "f5d08fd3ac5f8731490de541d47cb9981107c9d70bf2257c99f829c8051f32c2" }, "downloads": -1, "filename": "django-markitup-field-1.2.4-dev.zip", "has_sig": false, "md5_digest": "c7bc35c7af143bcbc212cad55e9250b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174197, "upload_time": "2012-12-29T17:40:52", "url": "https://files.pythonhosted.org/packages/e4/cb/57c149659d9b1734a4531b4c4533f59ba20e19e1db393207712f96b6013f/django-markitup-field-1.2.4-dev.zip" } ], "1.2.5-dev": [ { "comment_text": "", "digests": { "md5": "dfb827e9c0465f769cc515043382a53e", "sha256": "2cabdf6f1c9d43c7d3d05df38ef0f4b159b0e49b7334e2bfb8e383fcf0845753" }, "downloads": -1, "filename": "django-markitup-field-1.2.5-dev.zip", "has_sig": false, "md5_digest": "dfb827e9c0465f769cc515043382a53e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174191, "upload_time": "2012-12-29T17:47:20", "url": "https://files.pythonhosted.org/packages/aa/64/a162a791edc41c32061a09d2d6b31dc2114d00003cf96695b390072a7b6f/django-markitup-field-1.2.5-dev.zip" } ], "1.2.6-dev": [ { "comment_text": "", "digests": { "md5": "e07940b0f2664f3e8394404757b73056", "sha256": "bbf946a102d3ca14135c370ddd7a8ce0594d6c9aa44cdd8575a2d4718057d9d7" }, "downloads": -1, "filename": "django-markitup-field-1.2.6-dev.zip", "has_sig": false, "md5_digest": "e07940b0f2664f3e8394404757b73056", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174199, "upload_time": "2012-12-29T18:30:09", "url": "https://files.pythonhosted.org/packages/28/62/95f3089c9d5a0ee48d4ceaab1bec0ff654678549be9bbcaacebe03e21e83/django-markitup-field-1.2.6-dev.zip" } ], "1.2.7-dev": [ { "comment_text": "", "digests": { "md5": "96095d317483304e93b4d840a9ad4740", "sha256": "6dcb6df208dab917e840d86734c326c815cbffc282e653b24c9adf4c78241ec6" }, "downloads": -1, "filename": "django-markitup-field-1.2.7-dev.zip", "has_sig": false, "md5_digest": "96095d317483304e93b4d840a9ad4740", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174201, "upload_time": "2012-12-29T18:31:54", "url": "https://files.pythonhosted.org/packages/86/e8/fd5ef570a4ac747aac9511dc38abbfc6786091b8083f1c0f57cbc388b63c/django-markitup-field-1.2.7-dev.zip" } ], "1.2.8-dev": [ { "comment_text": "", "digests": { "md5": "c1fd52d95d456e3e37ff8b4d77ad3088", "sha256": "547e4f8d091dfef72ee9eb87bad0bc03ca9cb501ad08d3d149251dece3a87b34" }, "downloads": -1, "filename": "django-markitup-field-1.2.8-dev.zip", "has_sig": false, "md5_digest": "c1fd52d95d456e3e37ff8b4d77ad3088", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174209, "upload_time": "2012-12-29T18:36:46", "url": "https://files.pythonhosted.org/packages/3d/66/d3020314bd8911098100ac2e800801f21f3114f9e2ebbb9f10b611c1ae6b/django-markitup-field-1.2.8-dev.zip" } ], "1.2.9-dev": [ { "comment_text": "", "digests": { "md5": "f56084acef97a9666217e445f1d55367", "sha256": "110f6940d0f5766066129ef9b5aeb602532089c8c5f15c351add3c9efc717943" }, "downloads": -1, "filename": "django-markitup-field-1.2.9-dev.zip", "has_sig": false, "md5_digest": "f56084acef97a9666217e445f1d55367", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 174354, "upload_time": "2012-12-29T19:03:54", "url": "https://files.pythonhosted.org/packages/48/15/07443a783939819c7ba7710d9396ae8d9ec1dea026fa2813be7ff3968330/django-markitup-field-1.2.9-dev.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0a1e055ba712c1f7a7fd3dea1a38a794", "sha256": "6face93299180375a3c4512b0831638d7ed8caccb2c2363ee141f66d95b26772" }, "downloads": -1, "filename": "django-markitup-field-1.2.10.zip", "has_sig": false, "md5_digest": "0a1e055ba712c1f7a7fd3dea1a38a794", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 173622, "upload_time": "2012-12-29T19:19:47", "url": "https://files.pythonhosted.org/packages/2b/3f/bd9b9a1e74fdab96fab42fca106676c72c0e66a674adcab41e0793375df1/django-markitup-field-1.2.10.zip" } ] }