Skip to main content

blog-package

Author: puzzllium · puzzllium@gmail.com · LinkedIn

Blog site package built on core-package: posts with a cover picture and image gallery, comments, likes, saves (bookmarks) and share-count tracking. It never defines its own user model: every post, comment, like and save is owned by a core-package User via settings.AUTH_USER_MODEL.

Post.subject/description/text are translatable through a single translations JSON field ({"fa": {"subject": "..."}, "de": {...}}), so adding a language needs no migration: PUT /posts/{id}/translations/{language}.

Install

pip install blog-package

Requires Python 3.10+ and Django 5.2 (via core-package).

What's inside

The package ships the reusable blog Django app:

Module Purpose
blog.models Post, gallery image, comment, like, save
blog.api Django Ninja router (public reads, logged-in interactions, admin-only writes)
blog.schemas / blog.services Request/response schemas and business logic
blog.admin Django admin (Unfold) incl. cover and gallery image management

testproject/ is dev-only scaffolding for this repo's own tests and is not part of the installable package.

Dependencies

Required

Package Used for
core-package Auth, RBAC, the shared User model, base/translatable models, pagination, throttling
django-ninja >=1.7.0 REST API layer
django-unfold >=0.81.0 Admin theme
Pillow >=10.0 Post cover and gallery images

core-package in turn brings in Django 5.2 and the rest of the stack; see its README.

Optional extras

Extra Installs
dev pytest>=8, pytest-django>=4.14, pytest-asyncio>=1.4

Local development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

Installing into a Core-based project

  1. Install it into the host project's venv:
    pip install blog-package
    
  2. Add it to INSTALLED_APPS in the host's config/settings/base.py, under the # site packages comment:
    # site packages
    "blog",
    
  3. Mount its router in the host's config/api.py:
    from blog.api import router as blog_router
    ...
    api.add_router("/blog", blog_router)
    
  4. Migrate:
    python manage.py migrate
    

Installed automatically alongside portfolio: portfolio declares blog-package as a pip dependency (its site includes a blog section), so pip install portfolio-package pulls this package in for you too — but per Core's "no auto-discovery, explicit wiring" convention (§10), step 2 (INSTALLED_APPS) and step 3 (router mount) above still need doing by hand for blog, exactly like for portfolio itself. The pip dependency only saves you the pip install step, not the Django-level wiring.

Endpoints

Mounted at whatever prefix the host chooses (/blog in the example above). Reads are public; interactions require login; content writes are admin-only.

  • GET /posts — paginated list of published posts (public), optional ?user_id= and ?lang= (returns the post's translated subject/ description/text for that language if a translation exists, else the original)
  • GET /posts/by-slug/{slug} — published post detail (public), optional ?lang=
  • GET /posts/{post_id}/comments — paginated comments on a post (public)
  • POST /posts/{post_id}/comments — add a comment (logged in)
  • DELETE /comments/{comment_id} — delete a comment (its author, or admin)
  • POST /posts/{post_id}/like — toggle like on/off (logged in), returns the new state + like count
  • POST /posts/{post_id}/save — toggle save/bookmark on/off (logged in)
  • POST /posts/{post_id}/share — public, rate-limited by IP; increments and returns the post's share count (no account needed to share)
  • POST /posts, GET /posts/{post_id}, PATCH /posts/{post_id}, DELETE /posts/{post_id} — admin-only (require_role("admin"), from Core)
  • PUT /posts/{post_id}/translations/{language} — admin-only; sets/updates the translated subject/description/text for that language

Post pictures and gallery images are managed through the Django admin (same convention as the portfolio package's Project.cover_image/ProjectImage — no write API for images yet, deliberately, to avoid building endpoints nothing needs yet).

License

MIT. See LICENSE.

Metadata

Release files for blog-package 0.1.1

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

Source distribution (sdist)

Source distribution for blog-package 0.1.1
File Size Uploaded Provenance Actions
blog_package-0.1.1.tar.gz 15.9 kB With provenance Details for blog_package-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blog-package 0.1.1
File Interpreter ABI Platform Actions
blog_package-0.1.1-py3-none-any.whl Python 3 none any Details for blog_package-0.1.1-py3-none-any.whl

Total release size: 32.0 kB

Release files / blog_package-0.1.1.tar.gz

Download URL blog_package-0.1.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d692c668fc0c78ef8cb01921958ad0bafdc7f8ad3ab57a059dc797872e91201d
BLAKE2b-256 checksum
How to use checksums
904817694b801f1cc2ba9586b9b907e659af02299b46dc9ea5e8a9d8eaa105e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / blog_package-0.1.1-py3-none-any.whl

Download URL blog_package-0.1.1-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f10d6bf484a2a79ab40e653d2c722daf1210eb0c7c9bcfed58fc90fba56cf6c4
BLAKE2b-256 checksum
How to use checksums
8b723180782b73cf6b5d8a166910c94935175c82ee2bac9f03e2620fe5966e64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Security for blog-package 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blog_package-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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