{ "info": { "author": "devel.tech", "author_email": "i@devel.tech", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "django_slugify_processor: pipeline for handling slugification edgecases\n\n|pypi| |docs| |build-status| |coverage| |license|\n\nWhat are slugs?\n===============\n\n*Slugs* are URL's, typically generated from post titles, that you want to\nbe both human readable and a valid URL. They are SEO friendly.\n\nDjango provides a `slugify function `__\nin ``django.utils.text.slugify`` which is also made available as a\n`default filter `__.\n\nDjango slugs can be automatically generated in django models via packages\nsuch as:\n\n- `django-autoslug `__\n (`docs `__)\n (`github `__)\n- `django-extensions `__\n via `AutoSlugField `__\n (`docs `__)\n (`github `__)\n\nThe problem\n===========\n\nThis project is based on an article from `devel.tech `__\ncovering `django's import strings\n`__.\n\nCorner cases exist with slugification. For instance:\n\n================ ============================= =============\nTerm ``django.utils.text.slugify`` What you want\n================ ============================= =============\nC c (correct) n/a\nC++ c cpp\nC# c c-sharp\n================ ============================= =============\n\nTo make matters worse, if using a specialized model field like\n``AutoSlugField`` from django-autoslug or django-extensions, the default\nbehavior may be to name the slugs for C++ and C# to \"c-1\", \"c-2\" after \"c\" is\ntaken.\n\nHere's another case, acronyms / shorthands:\n\n================== ============================= ===================\nTerm ``django.utils.text.slugify`` What you (may) want\n================== ============================= ===================\nNew York City new-york-city nyc\nY Combinator y-combinator yc \nPortland portland pdx\nTexas texas tx\n\\$ '' (empty) usd, aud, etc?\nUS$ us usd\nA$ a aud\nbitcoin bitcoin btc\nUnited States united-states usa\nLeague of Legends league-of-legends league\nApple\u00ae iPod Touch apple-ipod-touch ipod-touch\n================== ============================= ===================\n\nEach website and niche has its own edge cases for slugs. So we need a solution\nthat can scale, where you can craft your own functions.\n\nHow django-slugify-processor helps\n==================================\n\nThis builds on top of `django.utils.text.slugify`_ to handle your django\nproject's edgecases. By default, django-slugify-processor will be a pass\nthrough to django's default behavior. Adding slugification functions via\nyour Django project's settings file allows you to adjust.\n\n.. _django.utils.text.slugify: https://docs.djangoproject.com/en/1.11/ref/utils/#django.utils.text.slugify\n\nInstallation\n============\n\n.. code-block:: sh\n\n $ pip install django-slugify-processor\n\nConfigure\n=========\n\nTo create a processor, create a function that accepts a string, and\nreturns a string. Assume this is *project/app/slugify_processors.py*:\n\n.. code-block:: python\n\n def my_processor(value):\n value = value.replace('++', 'pp')\n return value\n\nInside of your settings, add a ``SLUGIFY_PROCESSORS`` list of strings\nthat points to the function. Anything that's compatible with\n`import_string `__,\nin your settings file:\n\n.. code-block:: python\n\n SLUGIFY_PROCESSORS = [\n 'project.app.slugify_processors.my_processor'\n ]\n\nUsage\n=====\n\nIn normal django code\n---------------------\n\nImport ``slugify`` from ``django_slugify_processor.text``:\n\n.. code-block:: python\n\n from django_slugify_processor.text import slugify\n\n print(slugify('C++'))\n > 'cpp'\n\nTemplate code\n-------------\n\ndjango-slugify-processor is designed to override the built-in``slugify``\nfilter.\n\nvia load\n\"\"\"\"\"\"\"\"\n\nYou can load by default via ``{% load django_slugify_processor %}``\nin your template.\n\nIn your settings ``INSTALLED_APPS``:\n\n.. code-block:: python\n\n INSTALLED_APPS = [\n 'django_slugify_processor'\n ]\n\nIn your template:\n\n.. code-block:: django\n\n {% load slugify_processor %}\n {{\"C++\"|slugify}}\n\nvia built-in\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nTo make this available in all templates, in the ``OPTIONS`` of your\ntemplate engine, add ``django_slugify_processor.template_tags``:\n\n.. code-block:: python\n\n TEMPLATES = [{\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'OPTIONS': {\n 'builtins': [\n 'django_slugify_processor.templatetags.slugify_processor',\n ],\n },\n }]\n\nFrom within the template file:\n\n.. code-block:: django\n\n {{\"C++\"|slugify}}\n\nOutput should be: cpp\n\nModels\n------\n\nFor the most up to date documentation, view the documetation for the\nplugin you're using (e.g. django-autoslug or django-extensions).\n\nTo use django-slugify-processor's ``slugify`` instead of django's default,\nthere will be a field option to use the function.\n\ndjango-extensions\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nTested with 1.9.7 (2017-11-26):\n\n.. code-block:: python\n\n from django.db import models\n\n from django_extensions.db.fields import AutoSlugField\n from django_slugify_processors.text import slugify\n\n class MyModel(models.Model):\n title = models.CharField(max_length=255)\n slug = AutoSlugField(\n populate_from='title',\n slugify_function=slugify\n )\n\ndjango-autoslug\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nTested with 1.9.3 (2017-11-26):\n\n.. code-block:: python\n\n from django.db import models\n\n from autoslug import AutoSlugField\n from django_slugify_processors.text import slugify\n\n class MyModel(models.Model):\n title = models.CharField(max_length=255)\n slug = AutoSlugField(\n populate_from='title',\n slugify=slugify\n )\n\nCredits\n=======\n\n- travis.yml and tox.ini based off DRF's (BSD 2-clause licensed)\n- yapf configuration based off RTD / devel.tech's (MIT-licensed)\n\nProject details\n===============\n\n============== ============================================================================\npython support 2.7, >= 3.3, pypy, pypy3\ndjango support 1.11\nSource https://github.com/develtech/django_slugify_processor\nDocs https://django-slugify-processor.devel.tech\nAPI https://django-slugify-processor.devel.tech/en/latest/api.html\nChangelog https://django-slugify-processor.devel.tech/en/latest/history.html\nIssues https://github.com/develtech/django-slugify-processor/issues\nTravis http://travis-ci.org/develtech/django-slugify-processor\nTest Coverage https://codecov.io/gh/develtech/django-slugify-processor\npypi https://pypi.python.org/pypi/django-slugify-processor\nOpen Hub https://www.openhub.net/p/django_slugify_processor\nLicense MIT\ngit repo .. code-block:: bash\n\n $ git clone https://github.com/develtech/django-slugify-processor.git\ninstall stable .. code-block:: bash\n\n $ pip install django-slugify-processor\ninstall dev .. code-block:: bash\n\n $ git clone https://github.com/develtech/django-slugify-processor.git\n $ cd ./django-slugify-processor\n $ pipenv install --dev --skip-lock\n $ pipenv shell\n\ntests .. code-block:: bash\n\n $ make test\n============== ============================================================================\n\n.. |pypi| image:: https://img.shields.io/pypi/v/django-slugify-processor.svg\n :alt: Python Package\n :target: http://badge.fury.io/py/django-slugify-processor\n\n.. |build-status| image:: https://img.shields.io/travis/develtech/django-slugify-processor.svg\n :alt: Build Status\n :target: https://travis-ci.org/develtech/django-slugify-processor\n\n.. |coverage| image:: https://codecov.io/gh/develtech/django-slugify-processor/branch/master/graph/badge.svg\n :alt: Code Coverage\n :target: https://codecov.io/gh/develtech/django-slugify-processor\n\n.. |license| image:: https://img.shields.io/github/license/develtech/django-slugify-processor.svg\n :alt: License \n\n.. |docs| image:: https://readthedocs.org/projects/django-slugify-processor/badge/?version=latest\n :alt: Documentation Status\n :scale: 100%\n :target: https://readthedocs.org/projects/django-slugify-processor/", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/pypi/django-slugify-processor", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/develtech/django-slugify-processor/", "keywords": "django-slugify-processor", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-slugify-processor", "package_url": "https://pypi.org/project/django-slugify-processor/", "platform": "", "project_url": "https://pypi.org/project/django-slugify-processor/", "project_urls": { "Download": "https://pypi.python.org/pypi/django-slugify-processor", "Homepage": "http://github.com/develtech/django-slugify-processor/" }, "release_url": "https://pypi.org/project/django-slugify-processor/0.8.4/", "requires_dist": null, "requires_python": "", "summary": "pipeline for slugification edgecases in django", "version": "0.8.4" }, "last_serial": 3384275, "releases": { "0.8.0": [ { "comment_text": "", "digests": { "md5": "699c9e7b190975c1a0d101458d4f30b5", "sha256": "1d4bc2c8c41e7c7da21cbe6a51d68a827c918616ac58d61dbc39e6f27d5138bf" }, "downloads": -1, "filename": "django-slugify-processor-0.8.0.tar.gz", "has_sig": false, "md5_digest": "699c9e7b190975c1a0d101458d4f30b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7808, "upload_time": "2017-12-02T01:52:57", "url": "https://files.pythonhosted.org/packages/e9/72/a3061956717810cb3e697e164e49fcd93fefd72e1df8664585f8075bae89/django-slugify-processor-0.8.0.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "25032de23c4adbd81dd35d9fcdaa6945", "sha256": "f50b31eb64cbcaafde5395ec9dcf2091197c6441f31182b56ea6f039bea6ee68" }, "downloads": -1, "filename": "django-slugify-processor-0.8.1.tar.gz", "has_sig": false, "md5_digest": "25032de23c4adbd81dd35d9fcdaa6945", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7885, "upload_time": "2017-12-02T02:17:57", "url": "https://files.pythonhosted.org/packages/d2/6a/3934ae8fcd0cf6a0a4224e4d75efd44439c6095ddebfe180491ccfe7eb52/django-slugify-processor-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "32599ccc7fcd6b76833f99f0a4d53efd", "sha256": "544ffd29ae2190875734a62e375aaaa4b658bccc510542a45756f2de403f99b1" }, "downloads": -1, "filename": "django-slugify-processor-0.8.2.tar.gz", "has_sig": false, "md5_digest": "32599ccc7fcd6b76833f99f0a4d53efd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7792, "upload_time": "2017-12-02T04:45:07", "url": "https://files.pythonhosted.org/packages/3d/87/8f0f0d142b71ae90aa6392810e52064292815a6ed57440b3f283d65f70c6/django-slugify-processor-0.8.2.tar.gz" } ], "0.8.3": [ { "comment_text": "", "digests": { "md5": "befbe68677e8f2a7fee2ca15d73e51c7", "sha256": "9991a2e061d694c8e3036116e13a1be2d9c05e677c99ec6e1250eefb30846ed3" }, "downloads": -1, "filename": "django-slugify-processor-0.8.3.tar.gz", "has_sig": false, "md5_digest": "befbe68677e8f2a7fee2ca15d73e51c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7879, "upload_time": "2017-12-02T06:23:53", "url": "https://files.pythonhosted.org/packages/83/26/793f0ad3483e6c806596c51544714c2b9b90772b132e6a39b112fb758970/django-slugify-processor-0.8.3.tar.gz" } ], "0.8.4": [ { "comment_text": "", "digests": { "md5": "3c0d2c9e2b68970eada1e3f32361423a", "sha256": "f1c384f4443dc09560144acdffa098de064d6fa355cdd5c1dba0145f107d560c" }, "downloads": -1, "filename": "django-slugify-processor-0.8.4.tar.gz", "has_sig": false, "md5_digest": "3c0d2c9e2b68970eada1e3f32361423a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8183, "upload_time": "2017-12-03T06:43:08", "url": "https://files.pythonhosted.org/packages/45/2a/3bf6999db1f0061d23ef39b39a71cc00f4477271c7a9e65ba876ecdb6796/django-slugify-processor-0.8.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3c0d2c9e2b68970eada1e3f32361423a", "sha256": "f1c384f4443dc09560144acdffa098de064d6fa355cdd5c1dba0145f107d560c" }, "downloads": -1, "filename": "django-slugify-processor-0.8.4.tar.gz", "has_sig": false, "md5_digest": "3c0d2c9e2b68970eada1e3f32361423a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8183, "upload_time": "2017-12-03T06:43:08", "url": "https://files.pythonhosted.org/packages/45/2a/3bf6999db1f0061d23ef39b39a71cc00f4477271c7a9e65ba876ecdb6796/django-slugify-processor-0.8.4.tar.gz" } ] }