{ "info": { "author": "Igor `idle sign` Starikov", "author_email": "idlesign@yandex.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD 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.5", "Programming Language :: Python :: 3.6" ], "description": "django-sitecats\n===============\nhttps://github.com/idlesign/django-sitecats\n\n.. image:: https://idlesign.github.io/lbc/py2-lbc.svg\n :target: https://idlesign.github.io/lbc/\n :alt: LBC Python 2\n\n----\n\n.. image:: https://img.shields.io/pypi/v/django-sitecats.svg\n :target: https://pypi.python.org/pypi/django-sitecats\n\n.. image:: https://img.shields.io/pypi/l/django-sitecats.svg\n :target: https://pypi.python.org/pypi/django-sitecats\n\n.. image:: https://img.shields.io/coveralls/idlesign/django-sitecats/master.svg\n :target: https://coveralls.io/r/idlesign/django-sitecats\n\n.. image:: https://img.shields.io/travis/idlesign/django-sitecats/master.svg\n :target: https://travis-ci.org/idlesign/django-sitecats\n\n.. image:: https://landscape.io/github/idlesign/django-sitecats/master/landscape.svg?style=flat\n :target: https://landscape.io/github/idlesign/django-sitecats/master\n\n\nDescription\n-----------\n\n*Django reusable application for content categorization.*\n\nNay, - you say, - all that tags business lacks structuring.\n\nThis application is just about structuring your data: build categories hierarchy and link your site entities to those categories.\n\n\n.. code-block:: python\n\n # Somewhere in views.py\n from django.shortcuts import render, get_object_or_404\n\n # Suppose Article model has sitecats.models.ModelWithCategory class mixed in.\n from .models import Article\n\n\n def article_details(self, request, article_id):\n \"\"\"See, there is nothing special in this view, yet it'll render a page with categories for the article.\"\"\"\n return self.render(request, 'article.html', {'article': get_object_or_404(Article, pk=article_id)})\n\n def article_edit(self, request, article_id):\n \"\"\"Let's allow this view to render and handle categories editor.\"\"\"\n article = get_object_or_404(Article, pk=article_id)\n\n # Now we enable category editor for an article, and allow users\n # to add subcategories to `language`, and `os` categories\n # (suppose we created them beforehand with Admin contrib),\n # and link this article to them.\n article.enable_category_lists_editor(\n request,\n editor_init_kwargs={'allow_new': True},\n additional_parents_aliases=['language', 'os']\n )\n\n form = ... # Your usual Article edit handling code will be here.\n\n return render(request, 'article.html', {'article': article, 'form': form})\n\n\n\nTemplate coding basically boils down to ``sitecats_categories`` template tags usage:\n\n.. code-block:: html\n\n \n {% extends \"base.html\" %}\n {% load sitecats %}\n\n {% block contents %}\n \n \n\n