Repository navigation
PyCRMKit v1.2.0b2 - Django Campaign Persistence
Pre-releasePyCRMKit v1.2.0b2 - Django Campaign Persistence
Beta prerelease. Qualified source SHA: e4abf03.
Summary
The existing crm.campaigns facade can now persist Campaign data using the
optional Django ORM adapter. Domain API signatures and business invariants
remain unchanged for Memory and SQLAlchemy/PostgreSQL clients. The release
adds no new Campaign HTTP/DRF routes or marketing-delivery behavior.
Included
Six native Django Campaign tables, managed by additive migration
0004_campaign_persistence on top of 0003_segmentation:
pycrmkit_campaigns
pycrmkit_campaign_members
pycrmkit_campaign_segment_sources
pycrmkit_campaign_segment_members
pycrmkit_campaign_attributions
pycrmkit_campaign_communication_links
The implementation includes domain/ORM codecs, repositories and
DjangoTransactionBridge capabilities campaigns,
campaign_audience and campaign_linkage, sharing the same Django
transaction and on_commit event-publication boundary.
Campaign revisions use a compare-and-swap update under PostgreSQL.
Audience reads compose direct members and captured Segment members with
SQL UNION DISTINCT, including database-side pagination and counts.
Attribution uniqueness preserves external_ref=None via the database
representation "".
Segment-source identity is internal to Django. A technical BigAutoField
source PK and a real captured-member source_id FK preserve database
integrity without exposing ORM identifiers through the domain API.
Django CommunicationRecord boundary
A separate additive migration 0005_communication_record_store adds
native Django CommunicationRecord persistence. A narrow transactional
DjangoCommunicationRecordStore provides record save and lookup, enabling
the Campaign facade to validate that a record exists before linking it and
to hydrate linked records.
Scope limit: this is not the full Django
CommunicationRepository protocol. It does not implement
Communication intents, provider delivery attempts, delivery events, email
sending, queueing, or marketing operations. The Django UoW exposes
communication_records rather than falsely claiming the full
communications capability.
Compatibility and migration safety
- Python 3.11, 3.12 and 3.13; Django 5.2.x; optional DRF 3.18.x.
- The core wheel continues to import without Django/DRF dependencies.
- Existing Memory and SQLAlchemy Campaign contracts remain available.
- Previously published b1 Alembic migration
0006_campaign_persistence
and all historical release artifacts remain unchanged. - Django and SQLAlchemy Campaign tables have different physical
Segment-source FK layouts, despite sharing table names. Never independently
run Django and Alembic migrations against those same physical tables.
Use separate databases/schemas with one schema owner. - Django ORM-level
on_delete=CASCADEmust not be misrepresented as
PostgreSQL-nativeON DELETE CASCADE.
Installation (once publication is verified)
python -m pip install --pre "pycrmkit[django,postgresql]==1.2.0b2"
python manage.py migrate pycrmkit_crmBefore publication, install from a verified internal wheel or source
checkout; the command above does not assert current availability on PyPI.
A Django application that has registered
pycrmkit.integrations.django.apps.PyCRMKitDjangoConfig can construct its
CRM facade with DjangoTransactionBridge and use the existing
crm.campaigns.create/get/add_member/attach_segment_source/add_attribution/ link_communication methods. Linked CommunicationRecord objects must
actually be stored in the Django record store; they are not fabricated.
Main checks: 24/24. Build run: 40689320890. SHA256SUMS attached.
PyPI publication is separate and not implied.