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 /path/to/Core/Core # core-package, editable
pip install -e ".[dev]"
pytest
Installing into a Core-based project
- Install it editable into the host repo's venv:
source .venv/bin/activate pip install -e ../Packages/blog
- Add it to
INSTALLED_APPSin the host'sconfig/settings/base.py, under the# site packagescomment:# site packages "blog",
- Mount its router in the host's
config/api.py:from blog.api import router as blog_router ... api.add_router("/blog", blog_router)
- 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 -e ../Packages/portfolio 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 translatedsubject/description/textfor 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 countPOST /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 translatedsubject/description/textfor 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| blog_package-0.1.0.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| blog_package-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.8 kB
Release files / blog_package-0.1.0.tar.gz
| Download URL | blog_package-0.1.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4c2105c80a0642be407b9aaed62b050166c64978965b76de384a5de48a45b28
|
|
BLAKE2b-256 checksum How to use checksums |
212b4e33fb050ed0e71bbc82596c770f0d48f77576aba6569695222ff1c6640e
|
| 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 5, 2026.
Transparency logRelease files / blog_package-0.1.0-py3-none-any.whl
| Download URL | blog_package-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64701de465f2a985736e5e7bcb26a93d75faefa949afba0616b194dcb8886126
|
|
BLAKE2b-256 checksum How to use checksums |
4cfd7db5e03c325c58946aba07d72037b9ea9aca1117cf6750ce0338ff31d707
|
| 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 5, 2026.
Transparency log