Skip to main content

company-portfolio-package

A company/group site package for the Core boilerplate: a single Company profile (name, tagline, description, logo, contact info) plus its Members — each member is a Core User with their own public page (job title, department, tenure) whose bio/headline/skills/education/ certifications/social links come from the portfolio package, not a second copy of the same content here. It depends on core-package for auth, RBAC, and the shared User model, and on portfolio-package for that profile content — it never defines its own user/account model or duplicates portfolio's fields.

This package models one company/group (a singleton Company row, created automatically on first read — see services.get_company()), not a multi-tenant directory of many companies. If you need the latter, this package's Member model (drop its implicit "the one company" assumption and add a company FK) is the natural starting point, not a rewrite.

Company.tagline/description and Member.title are translatable via apps.core.models.TranslatableModel — a single translations JSON field per row, not a tagline_en/tagline_fa column per language. Add a language by calling PUT /translations/{language} or PUT /members/{id}/translations/{language}, no migration required.

Downloadable CVs

Both the company/group and each member expose GET .../cv:

  • If an admin (or, for a member, whoever has upload rights) has uploaded a CV file (Company.cv_file / Member.cv_file), it's served as-is.
  • Otherwise a CV is generated on the fly as a PDF (company/pdf.py, via reportlab) from the structured data already on hand: for a member, their Member fields plus their portfolio Profile/Skill/Education/ Certification/SocialLink rows; for the company, the Company row plus a directory of its active members. This always succeeds — there's no "no CV available" state — and stays in sync with profile edits without anyone re-uploading a file.

reportlab was chosen specifically because it's pure Python (no system libraries like Pango/Cairo that e.g. WeasyPrint needs), so this package installs the same way on every machine.

See Core's AGENT.md §10 ("Package architecture") for the full contract this package follows.

Install

pip install company-portfolio-package

Requires Python 3.10+ and Django 5.2 (via core-package). This also installs portfolio-package and blog-package.

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 company-portfolio-package
    
    This also pulls in core-package, portfolio-package and, transitively, blog-package automatically. You still need to do steps 2-4 for company itself (and, if not already done, for portfolio/ blog too) — Core's "no auto-discovery, explicit wiring" convention (§10) means the pip install is automatic, but INSTALLED_APPS/ router-mounting/migrate are not.
  2. Add it to INSTALLED_APPS in the host's config/settings/base.py, under the # site packages comment (after portfolio, since this package imports portfolio.models directly):
    # site packages
    "blog",
    "portfolio",
    "company",
    
  3. Mount its router in the host's config/api.py:
    from company.api import router as company_router
    ...
    api.add_router("/company", company_router)
    
  4. Migrate:
    python manage.py migrate
    
  5. Optional — add a nav entry under UNFOLD["SIDEBAR"]["navigation"] in the host's config/settings/base.py for Company/Member.

Endpoints

Mounted at whatever prefix the host chooses (/company in the example above). Reads are public; all writes are admin-only (require_role("admin"), from Core).

  • GET / — the company/group profile (public), optional ?lang=
  • GET /content — the whole landing-page document (public): brand, hero, about, services, projects, steps, stats, team, contact, socials, clients, testimonial, FAQ, values, timeline, posts, categories. Every text is {fa, en} (languages from COMPANY_CONTENT_LANGUAGES, default fa+en); services/projects come from portfolio, posts from blog, team from Member. Point the Puzzllium site's NEXT_PUBLIC_API_URL at .../company.
  • GET /content is public unless COMPANY_CONTENT_API_KEY is set in the host's settings; then it needs an X-API-Key: <key> header (401 otherwise).
  • GET /cv — download the company/group CV (public): the uploaded file if one exists, else an auto-generated PDF
  • GET /members — paginated list of active members (public), optional ?lang=
  • GET /members/{member_id} — a member's public page (public), optional ?lang= — merges Member with their portfolio Profile
  • GET /members/{member_id}/cv — download that member's CV (public): the uploaded file if one exists, else an auto-generated PDF
  • PATCH /, PUT /translations/{language} — update the company profile / its translations
  • POST /logo, POST /cv — upload the company logo / CV file (multipart)
  • POST /members, PATCH /members/{member_id}, DELETE /members/{member_id} — manage membership (links an existing user_id; does not create or delete the User itself)
  • PUT /members/{member_id}/translations/{language} — set a member's translated title
  • POST /members/{member_id}/cv — upload a member's CV file (multipart)

Seeding the landing-page content

python manage.py import_site_content puzzllium-content.json --owner-email you@example.com

Loads a site-content JSON into Company, the content blocks (steps, stats, values, timeline, FAQ, categories, socials, testimonial) and the owner's portfolio services/projects and blog posts (English in the base columns, other languages in translations). Team members are real accounts and are not created — add them as Members (with a name) and fill their portfolio Profile/skills. Images are uploaded in the admin. Requires blog in INSTALLED_APPS next to portfolio and company.

Admin panel backend (company.panel, optional)

A second Django app shipped in this package (app label panel) that backs the frontend admin panel. It adds to the company router:

  • Panel login — POST /auth/login issues a panel token (a JWT signed with Core's key, aud="panel", valid 7 days); POST /auth/refresh (with a user's token) issues a fresh one, so a client that stays signed in (MasterPanel) never needs the password again; PUT /auth/credentials changes your own email/password. Roles come from the user row on every request: superuser = owner, staff = editor.

  • Panel users (owner only) — GET/POST/DELETE /users. Removing a user only revokes staff access; the last owner can't be demoted or removed.

  • Product identity (core-package >= 0.3) — GET/PUT /identity for a panel user who is an owner: core's own identity handlers (same checks and storage as core's /api/admin/identity), reachable with a panel token.

  • Page layout (page builder) — layout: {home: [section, ...]} in the content is the home page's sections (order, shown/hidden, in the menu, title, background, screens; free sections made of blocks), and pages[].sections an extra page made of sections (company.layout: known types and keys only, links without javascript:, files only /media/ or http(s)). A client that leaves the keys out keeps them.

  • Contact-form messages — public POST /messages (throttled), and GET /messages, PATCH/DELETE /messages/{id} for the panel; POST /messages/import (owner) brings in messages kept elsewhere before, with their date and read state (running it again adds nothing twice).

  • Site content, write side — PUT /content (saves the document from GET /content back to the models), GET/POST /content/history (list / restore snapshots; restore is owner-only) and POST /upload (images, 8 MB max).

  • Footer trust badges (e-Namad, Samandehi…) — badges in the content document (title, link, image upload / imageUrl of the issuer, width 24–240, active); src is the picture to show. Links and addresses must be https://.

  • Backup & restore (owner only) — GET /backup (state, files, free disk), POST /backup (start), GET /backup/job (poll), GET/DELETE /backup/files/{name}, POST /backup/restore (upload a zip) and POST /backup/files/{name}/restore. One zip holds every table (dumpdata --all, PostgreSQL or SQLite), MEDIA_ROOT and CONTENT_HISTORY_DIR. A restore first saves a pre-restore copy, replaces the database in one transaction and the files exactly, and refuses zips from a newer schema or with unsafe paths. Settings: BACKUP_DIR (default <MEDIA_ROOT>/../backups; must be outside MEDIA_ROOT and on a persistent disk) and BACKUP_KEEP (default 7).

  • Visit statistics — POST /analytics/pageview (called by the site's server with the visitor's ip / user agent / referrer, guarded by the shared key) and GET /analytics?days=30 (totals vs the previous period, daily series, top pages, channels, referrers, campaigns, devices, browsers, systems, languages, hours, weekdays). Cookie-free: only daily counters are stored, visitors are a daily-salted hash kept in the cache. COMPANY_ANALYTICS_TIMEZONE (default TIME_ZONE) sets where midnight is.

Errors use {"error": "<code>"}, the codes the panel maps to text.

# settings.py
INSTALLED_APPS = [..., "blog", "portfolio", "company", "company.panel"]
MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "corsheaders.middleware.CorsMiddleware",
    "company.panel.middleware.PanelAuthMiddleware",
    ...,
]
COMPANY_CONTENT_API_KEY = os.environ["COMPANY_CONTENT_API_KEY"]  # required here: empty = content API is public
CONTENT_HISTORY_DIR = BASE_DIR / "content_history"  # optional (default); keep it out of MEDIA_ROOT
CONTENT_HISTORY_LIMIT = 50                          # optional

# api
from company.panel import api as panel_api
panel_api.register(company_router)  # before api.add_router("/company", company_router)

PanelAuthMiddleware turns Authorization: Bearer <token> — the COMPANY_CONTENT_API_KEY itself (owner, no user) or a panel login token — into request.panel_role / request.panel_user, and sets X-API-Key so ContentApiKeyAuth admits the request.

Metadata

Release files for company-portfolio-package 0.7.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 company-portfolio-package 0.7.2
File Size Uploaded Provenance Actions
company_portfolio_package-0.7.2.tar.gz 61.1 kB With provenance Details for company_portfolio_package-0.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for company-portfolio-package 0.7.2
File Interpreter ABI Platform Actions
company_portfolio_package-0.7.2-py3-none-any.whl Python 3 none any Details for company_portfolio_package-0.7.2-py3-none-any.whl

Total release size: 131.6 kB

Release files / company_portfolio_package-0.7.2.tar.gz

Download URL company_portfolio_package-0.7.2.tar.gz
Size 61.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6b4c98a708752448abf4892393b1daaceabecd0267dccd24c6e17dc1febe1649
BLAKE2b-256 checksum
How to use checksums
eee8c55e5ff5f1077699ebb97bdfcd6eebdaab23f4c12a0733bbbfb82f8a2d27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / company_portfolio_package-0.7.2-py3-none-any.whl

Download URL company_portfolio_package-0.7.2-py3-none-any.whl
Size 70.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cd20fe9aa5121cc5defcdd78dbed37d79a1c072b94c4084a3fffc773572fbfe
BLAKE2b-256 checksum
How to use checksums
7009c2f3766e4d56e35b7f6f47124ea37f05a4b0d2e329bb4bd8c5a8d099425b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for company-portfolio-package 0.7.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.

Full provenance

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

Select from 2 files

Attestation for company_portfolio_package-0.7.2.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 Nov 17, 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.

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