Skip to main content

https://github.com/idlesign/django-sitecats

https://img.shields.io/pypi/v/django-sitecats.svg https://img.shields.io/pypi/l/django-sitecats.svg https://img.shields.io/coveralls/idlesign/django-sitecats/master.svg

Description

Django reusable application for content categorization.

Nay, - you say, - all that tags business lacks structuring.

This application is just about structuring your data: build categories hierarchy and link your site entities to those categories.

# Somewhere in views.py
from django.shortcuts import render, get_object_or_404

# Suppose Article model has sitecats.models.ModelWithCategory class mixed in.
from .models import Article


def article_details(self, request, article_id):
    """See, there is nothing special in this view, yet it'll render a page with categories for the article."""
    return self.render(request, 'article.html', {'article': get_object_or_404(Article, pk=article_id)})

def article_edit(self, request, article_id):
    """Let's allow this view to render and handle categories editor."""
    article = get_object_or_404(Article, pk=article_id)

    # Now we enable category editor for an article, and allow users
    # to add subcategories to `language`, and `os` categories
    # (suppose we created them beforehand with Admin contrib),
    # and link this article to them.
    article.enable_category_lists_editor(
        request,
        editor_init_kwargs={'allow_new': True},
        additional_parents_aliases=['language', 'os']
    )

    form = ... # Your usual Article edit handling code will be here.

    return render(request, 'article.html', {'article': article, 'form': form})

Template coding basically boils down to sitecats_categories template tags usage:

<!-- The same html is just fine for demonstration purposes for both our views.
     Do not forget to load `sitecats` template tags library. -->
{% extends "base.html" %}
{% load sitecats %}

{% block contents %}
    <!-- Some additional functionality (e.g. categories cloud rendering,
         editor enhancements) will require JS. -->
    <script src="{{ STATIC_URL }}js/sitecats/sitecats.min.js"></script>

    <h1>{{ article.title }}</h1>
    <div id="article_categories">
        {% sitecats_categories from article %} <!-- And that's it. -->
    </div>
    <!-- Form code goes somewhere here. -->
{% endblock %}

Read the docs, sitecats can do more.

Documentation

https://django-sitecats.readthedocs.org/

Metadata

Release files for django-sitecats 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sitecats 1.2.2
File Size Uploaded Provenance
django-sitecats-1.2.2.tar.gz 37.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sitecats 1.2.2
File Interpreter ABI Platform
django_sitecats-1.2.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 73.9 kB

Release files / django-sitecats-1.2.2.tar.gz

Download URL django-sitecats-1.2.2.tar.gz
Size 37.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e722d4d5527a2d04a7fdffb7e3bc3e95cda6569c9f4e4a042a3b98807ab0c96
BLAKE2b-256 checksum
How to use checksums
21b3730b8834211b77e92a9bb7455fcef480f99fcf77c75f8a7255641e396194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release files / django_sitecats-1.2.2-py2.py3-none-any.whl

Download URL django_sitecats-1.2.2-py2.py3-none-any.whl
Size 36.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
af495258369cca8adba857d2cf47bec6d3e0d2af61e268ba57cdbd069e6f0f02
BLAKE2b-256 checksum
How to use checksums
229a3f5f69666846f01168c8a309855ec0a1e6459bd1ca5587335eaaac27db14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Security for django-sitecats 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page