Skip to main content

Abstract Django referral library: models registry, attribution service, reward ledger helpers

Project description

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.AbstractReferralAttribution
  • referral.models.AbstractReferralScheme
  • referral.models.AbstractReferralCodeMap
  • referral.models.AbstractReferralRewardTransaction

Run migrate in the host app that owns those tables.


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 DefaultTimeStamp base in your project and adjust forked abstracts, or
  • keep shared on PYTHONPATH / install your internal shared package 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

referral_system-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

referral_system-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file referral_system-0.1.0.tar.gz.

File metadata

  • Download URL: referral_system-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for referral_system-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb7fa9124a57dcc97c5ad9440ee6bebb01cb6e3a4b9ea98370c050cf31a353d0
MD5 9337125a65467b9e9b95346ef78daa32
BLAKE2b-256 ddb3b72ca5f8aefb87b89d976fc7295a56753131aa02ce6788840c0bcb389dbe

See more details on using hashes here.

File details

Details for the file referral_system-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for referral_system-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36ac1872df3a103e0cd60c82106b88e685ae1ed7fd676edb1a3aff1b5d1c182f
MD5 6c42421016ebd796a8275d330cfe1af7
BLAKE2b-256 824cd30020feffff71d1ea10e7e617cd21b4d3b85e3d2933dd37bc42a0d3aacf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page