A simple reusable Django app for managing appointments
Project description
Django Simple Appointments
A lightweight framework for managing appointments generically in Django applications. It provides models, utilities, and a FormWizard view to handle providers, recipients, activities, time slots, pricing, and overlap validation.
Installation
-
Install the package via pip:
pip install django-simple-appointments
-
Add
simple_appointmentstoINSTALLED_APPSinsettings.py:INSTALLED_APPS = [ ..., 'simple_appointments', ]
-
Apply migrations:
python manage.py migrate
Appointment Model
The Appointment model has the following fields:
-
providers: Users who perform the appointment (e.g., a barber in a barbershop).
-
recipients: Users who receive the appointment (e.g., a client in a barbershop).
-
activities: Activities to be performed in the appointment.
- These fields are many-to-many (M2M) relationships, allowing multiple objects.
- Can be overridden in
settings.py:APPOINTMENTS_PROVIDERS_MODEL = "your_app.YourModel" APPOINTMENTS_RECIPIENTS_MODEL = "your_app.YourModel" APPOINTMENTS_ACTIVITIES_MODEL = "your_app.YourModel"
-
status: Indicates the appointment's current status. Default options:
APPOINTMENTS_STATUS_CHOICES = [ ("", "Not specified"), ("pending", "Pending"), ("confirmed_by_recipients", "Confirmed by Recipients"), ("canceled_by_recipients", "Canceled by Recipients"), ("canceled_by_providers", "Canceled by Providers"), ("completed", "Completed"), ("no_show", "No-show"), ]
- Can be customized in
settings.py.
- Can be customized in
-
price: The appointment's price.
-
auto_price: If
True, the price is calculated by summing thepriceattribute of the activities. If a price is set manually, it will be overridden by the automatic calculation. -
is_blocked: If
True, blocks the time slot, preventing new appointments (e.g., reserving a slot for an unavailable barber). -
date: Appointment date.
-
start_time: Start time of the appointment.
-
end_time: End time of the appointment.
-
auto_end_time: If
True,end_timeis calculated automatically based on theduration_timeattribute of activities. IfFalseandend_timeis empty,end_timewill matchstart_time. -
prevents_overlap: If
True(default), prevents conflicting appointments for the same provider at the same time. IfFalse, allows overlaps.
FormWizard
The package includes a FormWizard-based view that automatically calculates available time slots, considering existing appointments and the duration of selected activities.
How to Use the FormWizard
-
Import and configure the view:
from simple_appointments.views import FormWizardView class ExampleFormWizardView(FormWizardView): template_name = "your_template.html" next_url = "your_url" success_url = "your_success_url" prevents_overlap = True is_blocked = False start_time = time(8, 0) # Starts at 8 AM end_time = time(18, 0) # Ends at 6 PM interval = timedelta(minutes=10) # 10-minute intervals
-
Default
FormWizardstructure:forms_map = { 1: (RecipientsStepForm, 2), 2: (ProviderStepForm, 3), 3: (ActivitiesStepForm, 4), 4: (DateStepForm, 5), 5: (TimeStepForm, 6), 6: (ConfirmStepForm, None), }
- To customize, override
forms_mapin your class. - To modify the
TimeStepForm, override the method:def get_time_step_form(self): return YourCustomTimeStepForm
- To customize, override
Development
To contribute or test locally:
-
Clone the repository:
git clone https://github.com/lucas-eduardo7/django-simple-appointments.git cd django-simple-appointments
-
Install development dependencies:
pip install -e ".[dev]"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_simple_appointments-0.1.0.tar.gz.
File metadata
- Download URL: django_simple_appointments-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
738bd137938c5ae92460dca85bc74ec0bb0ff8793a90ab7dff84d85798704442
|
|
| MD5 |
611f9d48905e88ec3220d0eab5b33b8c
|
|
| BLAKE2b-256 |
5d076e5a7c4903e15bde1472d04bad2f3c4e5de1bb3de8de7dd1b8cd986e59d5
|
File details
Details for the file django_simple_appointments-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_simple_appointments-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f81da43f1cf50d9cd71a413777b8676a4052b98c7ec6d7192eac8899915ee160
|
|
| MD5 |
8cfeacaa13a5ae4affd32c8916c74539
|
|
| BLAKE2b-256 |
1cabcdb1a4d3e15880a5a3cdba6617e5d092f62ae69cd1cea148dc30767fd18d
|