Skip to main content

django-blog-core

CI/CD PyPI License: MIT Docs codecov

Reusable multi-blog Django app: Blog, optional Section, and Article with draft / scheduled / published / archived workflow, RSS + Atom feeds, a Pinax-style hookset, secret preview URLs, and optional Markdown / HTML sanitize extras.

Status: 0.1.x on PyPI. Extras [search], [tags], [social], [images] are documented stubs; [events] ships a working, opt-in ArticleEvent timeline model.

Install

pip install django-blog-core
pip install "django-blog-core[markdown]"   # Markdown bodies
pip install "django-blog-core[sanitize]"   # bleach HTML policy
pip install "django-blog-core[all]"        # markdown + sanitize

Quickstart

# settings.py
INSTALLED_APPS = [
    # ...
    "blog_core",
]

BLOG_CORE = {
    "PAGINATE_BY": 12,
    "SANITIZE_HTML": True,
    # "HOOKSET": "myapp.hooks.BlogHookSet",
}
# Or: BLOG_CORE_HOOKSET = "myapp.hooks.BlogHookSet"
# urls.py
from django.urls import include, path

urlpatterns = [
    path("blog/", include("blog_core.urls")),
]
python manage.py migrate
python manage.py publish_scheduled_articles   # cron / host scheduler

Create a Blog and Article in admin. Public list/detail live at /blog/<blog-slug>/ and /blog/<blog-slug>/<article-slug>/. Feeds:

  • /blog/<blog-slug>/feed/rss/
  • /blog/<blog-slug>/feed/atom/

Preview drafts with the secret URL from the admin “Preview” column.

Public visibility

Article.objects.published() (alias public()) is the single source of truth:

state == "published" and publish_at <= now.

Hookset

Subclass blog_core.hookset.DefaultBlogHookSet to customize absolute URLs, who may view non-public articles, body rendering, and feed titles — without forking the package. Hooksets must not widen the public queryset.

HTML / Markdown safety

  • Markdown → HTML via the [markdown] extra.
  • HTML (and Markdown output) is sanitized with bleach when [sanitize] is installed and BLOG_CORE["SANITIZE_HTML"] is true (default).
  • Without bleach, HTML is escaped rather than passed through.
  • Set ALLOW_RAW_HTML = True only if you accept XSS risk. See docs/sanitize.md.

Extras

Extra Purpose
[markdown] Markdown body rendering
[sanitize] bleach allow-list
[search] stub — Haystack/published() index patterns
[tags] stub — tagging integration
[social] stub — share matrix
[images] stub — media attachments
[events] domain-neutral ArticleEvent timeline; opt in via INSTALLED_APPS — see docs/extras.md

Development

pip install -e ".[testing]"
pytest
# or: tox -e py313-django52

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_blog_core-0.1.4.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_blog_core-0.1.4-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file django_blog_core-0.1.4.tar.gz.

File metadata

  • Download URL: django_blog_core-0.1.4.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_blog_core-0.1.4.tar.gz
Algorithm Hash digest
SHA256 01c6db237acf2a88e9e5da8a724d3b80243e68a462d68bb541eae93acd46a31a
MD5 ff4c1b93dd82519fca80dd3364e751da
BLAKE2b-256 32a0c851a6f3b4e2159389e0ef908507002c57cedb332a8eb74f6a212102653d

See more details on using hashes here.

File details

Details for the file django_blog_core-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_blog_core-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 09be6a6ae10d1fc16cfe6ace58c762e3fe406400681b01096c2010b5f9761aba
MD5 f08b564effb0bf4722af609da082bb77
BLAKE2b-256 cce080429e57e25a9f08476a763bb0c4006e00b0ab2d41502112a9b646a887da

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page