{"id":15662201,"url":"https://github.com/idlesign/django-sitecats","last_synced_at":"2025-05-05T23:40:56.507Z","repository":{"id":14425130,"uuid":"17136239","full_name":"idlesign/django-sitecats","owner":"idlesign","description":"Django reusable application for content categorization.","archived":false,"fork":false,"pushed_at":"2022-02-04T12:37:30.000Z","size":181,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T12:13:55.304Z","etag":null,"topics":["categories","django","navigation","python","tagcloud","tags"],"latest_commit_sha":null,"homepage":"https://github.com/idlesign/django-sitecats","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idlesign.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-24T13:03:24.000Z","updated_at":"2025-02-06T16:00:36.000Z","dependencies_parsed_at":"2022-08-29T04:31:09.266Z","dependency_job_id":null,"html_url":"https://github.com/idlesign/django-sitecats","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-sitecats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-sitecats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-sitecats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idlesign%2Fdjango-sitecats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idlesign","download_url":"https://codeload.github.com/idlesign/django-sitecats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596320,"owners_count":21773842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["categories","django","navigation","python","tagcloud","tags"],"created_at":"2024-10-03T13:30:40.357Z","updated_at":"2025-05-05T23:40:56.476Z","avatar_url":"https://github.com/idlesign.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-sitecats\n===============\nhttps://github.com/idlesign/django-sitecats\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\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    \u003c!-- The same html is just fine for demonstration purposes for both our views.\n         Do not forget to load `sitecats` template tags library. --\u003e\n    {% extends \"base.html\" %}\n    {% load sitecats %}\n\n    {% block contents %}\n        \u003c!-- Some additional functionality (e.g. categories cloud rendering,\n             editor enhancements) will require JS. --\u003e\n        \u003cscript src=\"{{ STATIC_URL }}js/sitecats/sitecats.min.js\"\u003e\u003c/script\u003e\n\n        \u003ch1\u003e{{ article.title }}\u003c/h1\u003e\n        \u003cdiv id=\"article_categories\"\u003e\n            {% sitecats_categories from article %} \u003c!-- And that's it. --\u003e\n        \u003c/div\u003e\n        \u003c!-- Form code goes somewhere here. --\u003e\n    {% endblock %}\n\n\nRead the docs, ``sitecats`` can do more.\n\n\nDocumentation\n-------------\n\nhttps://django-sitecats.readthedocs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlesign%2Fdjango-sitecats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidlesign%2Fdjango-sitecats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidlesign%2Fdjango-sitecats/lists"}