Skip to main content

Reusable Django app for modelling service providers and resources in booking systems.

Project description

django-providers

Reusable Django app for modelling service providers and resources in booking systems.

Overview

django-providers models who or what can deliver a service within a booking ecosystem. It introduces a dedicated providers layer so that services, availability, and booking flows can treat providers as first-class objects rather than ad-hoc foreign keys. The design mirrors SimplyBook-style separation without claiming feature parity; it focuses solely on representing providers and their capability to deliver services.

Scope

What this app provides

  • Provider and resource models with common metadata (name, provider_type, visibility, ordering)
  • Mapping between services and the providers/resources that can deliver them
  • Reusable abstractions for distinguishing people and physical resources while sharing behaviour
  • Optional multi-tenancy support without enforcing a tenancy framework

What this app does NOT provide

  • Availability schedules or calendars
  • Slot generation or time-based allocation logic
  • Booking creation, amendments, or cancellations
  • Payments, invoicing, or notifications
  • User authentication or identity management

Design Philosophy

  • Separation of concerns: services = what is offered; providers = who delivers it; availability = when it can happen.
  • Provider is not necessarily a user; a provider may or may not map to an authenticated account.
  • Supports both human providers (e.g., tutors) and physical resources (e.g., rooms or equipment).
  • Multi-tenant friendly: optional PROVIDERS_TENANT_MODEL adds required tenant FKs without forcing a specific tenancy package.
  • Integrates cleanly into larger systems without forcing a specific architecture; it stays narrow and composable.

Current Status

  • Early development; public API may change.
  • Focus is correctness, clarity, and extensibility over breadth.
  • Breaking changes are expected before v1.0.

Installation

Tested with Python 3.10+ and Django 4.2+.

pip install mroudai-django-providers

Add to INSTALLED_APPS and run migrations:

# settings.py
INSTALLED_APPS = [
    # ...
    "providers",
    "services",  # your services app
]

# Optional settings
PROVIDERS_TENANT_MODEL = None  # e.g. "tenants.Tenant"
PROVIDERS_ALLOW_RESOURCE_PROVIDERS = True
python manage.py migrate

If PROVIDERS_TENANT_MODEL is set, provider-scoped models include a required tenant FK and uniqueness is enforced per tenant.

Basic Usage Example

from providers.models import Provider, ProviderService
from services.models import Service

# Create a human provider (global mode)
tutor = Provider.objects.create(
    name="Alex Tutor",
    provider_type=Provider.ProviderType.PERSON,
)

# Link a service to the provider's capability
maths = Service.objects.create(name="Maths 101", slug="maths-101")
ProviderService.objects.create(provider=tutor, service=maths)

In tenant mode, include tenant= on provider, service, and provider-service relations; the app enforces tenant consistency.

Intended Use Cases

  • Tutors and educators
  • Salons and barbers
  • Clinics and consultants
  • Gyms and fitness instructors
  • Resource-based bookings (rooms, courts, equipment)

Relationship to Other Apps

django-providers is designed to sit alongside:

  • services: defines what is offered.
  • availability: defines when providers are available.
  • slots / bookings (future): turns availability into bookable slots and handles reservations.

The providers app remains focused on "who" to keep integration points clear.

Testing

  • Tests use Django's TestCase.
  • Coverage emphasises provider–service relationships, validation, tenancy enforcement, and model invariants.
  • Run tests with the built-in runner: python test providers (executes both non-tenant and tenant configurations; python test also works).
  • Contributions should include tests that exercise new behaviour or edge cases.

Contributing

  • Contributions are welcome; small, focused pull requests are preferred.
  • Please discuss architectural changes and boundaries before large refactors.
  • Respect the early-stage nature of the project and the likelihood of API changes.

Licence

MIT Licence.

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

mroudai_django_providers-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

mroudai_django_providers-0.1.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mroudai_django_providers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f86504af7c03b72465842e4779a1c0585e4f18bc1664fa221dcd2fdb9491178
MD5 b6de8eda0670e42b9b97e30638680e71
BLAKE2b-256 d21b108576c64c51f15fb11cf3f154336a05a3628e0ec7b7f71c102ade88190d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mroudai_django_providers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fcf78a8ee3f6a7e1ee56c9fb991cf879f564e33054b3ef1e114171e65c5f263
MD5 63d85a2e2fe317de523d81326835bc3d
BLAKE2b-256 deae38606d4c03c30bff7cb41fb072a003c7896194eba07a1eeb981de00d175a

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