referral-system (abstract referral package)
This wheel ships only the Django app package referral: abstract referral models, referral.model_registry, ReferralAttributionService, and related helpers.
It does not include referral_program or any product-specific InstaMoney glue (loan, user, etc.). Host projects must define concrete models subclassing referral.models abstracts and point settings.REFERRAL_MODELS at those models.
Install (private index)
Build locally:
pip install build twine
python -m build
Upload to your private PyPI-compatible registry (GitHub Packages, CodeArtifact, Devpi, etc.):
twine upload --repository-url https://YOUR_REGISTRY/simple dist/*
Consumers:
pip install referral-system --extra-index-url https://TOKEN@YOUR_REGISTRY/simple
Django settings
INSTALLED_APPS
Add referral before any app that defines concrete referral models registered via REFERRAL_MODELS:
INSTALLED_APPS = [
# ...
"referral",
"your_app_with_concrete_referral_models",
]
REFERRAL_MODELS
Map logical roles to your concrete models (app_label + model_name):
REFERRAL_MODELS = {
"attribution": {
"app_label": "your_app_with_concrete_referral_models",
"model_name": "ReferralAttribution",
},
"scheme": {
"app_label": "your_app_with_concrete_referral_models",
"model_name": "ReferralScheme",
},
"code_map": {
"app_label": "your_app_with_concrete_referral_models",
"model_name": "ReferralCodeMap",
},
"reward_transaction": {
"app_label": "your_app_with_concrete_referral_models",
"model_name": "ReferralRewardTransaction",
},
}
Concrete classes must subclass:
referral.models.AbstractReferralAttributionreferral.models.AbstractReferralSchemereferral.models.AbstractReferralCodeMapreferral.models.AbstractReferralRewardTransaction
Run migrate in the host app that owns those tables.
Reward transaction entity fields (0.2.0+)
AbstractReferralRewardTransaction includes generic ledger reference columns:
| Field | Purpose |
|---|---|
transaction_context_type |
Business context (e.g. REFERRAL_ATTRIBUTION, CAMPAIGN_REWARD) |
transaction_context_id |
PK of that context object |
transaction_party |
Party within the context (e.g. referrer, referee, winner) |
Status lifecycle includes INITIATED, PENDING, COMPLETED, FAILED, TIMEOUT, REVERSED.
Use referral.services.referral_reward_transaction_helper for inserts and entity-scoped queries.
Dependencies
Declared in pyproject.toml: Django, djangorestframework, pydantic (used by optional schema paths).
The referral package imports shared.helper.shared_models (DefaultTimeStamp on abstracts). Either:
- vendor a compatible
DefaultTimeStampbase in your project and adjust forked abstracts, or - keep
sharedonPYTHONPATH/ install your internalsharedpackage alongside this wheel.
Same applies if you copy code that referenced other internal modules—this PyPI distribution contains only referral/.
Versioning
Bump version in pyproject.toml before each release; rebuild and re-upload the wheel.
Publishing to PyPI.org
Step-by-step (tokens, TestPyPI, production upload, GitHub Actions): PYPI_PUBLISH.md.
Metadata
Release files for referral-system 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| referral_system-0.2.2.tar.gz | 13.2 kB | Without provenance | Details for referral_system-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| referral_system-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for referral_system-0.2.2-py3-none-any.whl |
Total release size: 26.6 kB
Release files / referral_system-0.2.2.tar.gz
| Download URL | referral_system-0.2.2.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c632baa7cc5cdd50212d16429595c33ebf52fa5657c2b313b559ea8dac7228d
|
|
BLAKE2b-256 checksum How to use checksums |
8a8132dbf66cc71a8feff852cecf88b71488d9223dc91ee0d452e7b70ce22477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / referral_system-0.2.2-py3-none-any.whl
| Download URL | referral_system-0.2.2-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6482b0b93c275372ccd8720b59f5dd94335292467db482e86d3eaaef2024513a
|
|
BLAKE2b-256 checksum How to use checksums |
58dc994f8c2392aa78e21ef04856e257c4aebd52d391b8e39e73fd422270341b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for referral-system 0.2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.