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"); 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.
  • Contact-form messages — public POST /messages (throttled), and GET /messages, PATCH/DELETE /messages/{id} for the panel.
  • 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).

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.2.0

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.2.0
File Size Uploaded Provenance Actions
company_portfolio_package-0.2.0.tar.gz 36.9 kB With provenance Details for company_portfolio_package-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 77.5 kB

Release files / company_portfolio_package-0.2.0.tar.gz

Download URL company_portfolio_package-0.2.0.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6895ddc17feb0c4a3579bdd03a9cbfdb4a55761b1ad2e3826d1e78c9fd88fe1b
BLAKE2b-256 checksum
How to use checksums
8758706d00034b49a2ade8335551e3f144a061644fd71cd05ec6ddf0cc5b6758
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 16, 2026.

Transparency log

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

Download URL company_portfolio_package-0.2.0-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10bc11254afdaa0af7df1c228e7268dc827b3fae2760d0dc705c0fc43308291d
BLAKE2b-256 checksum
How to use checksums
ca966968578d208929fc5a313c69834b1c337854d507ffa56e7819fae74a72fe
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 16, 2026.

Transparency log

Security for company-portfolio-package 0.2.0

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.2.0.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 16, 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