Appointment Scheduler
Appointment Scheduler is a generic and flexible appointment scheduling package for Django applications. It is designed to work with any model (e.g., doctor, tutor, counsellor) and provides a robust and efficient way to manage availability, slots, and appointments.
Features
- Generic and Flexible: Works with any Django model using GenericForeignKey.
- Advanced Slot Management: Create, update, and delete slots dynamically.
- Robust Booking System: Book and cancel appointments seamlessly.
- Efficient Slot Generation: Automatically generate slots based on availability and slot duration.
- Customizable Weekly Offs: Configure off days and handle "Off" periods.
- Conflict Resolution: Prevents overlapping slots and handles cancellations gracefully.
Installation
You can install the package using pip:
pip install django-appointment-scheduler
🚀 Django Appointment Scheduler - Quick Start
Step 1: Install Dependencies
pip install Django djangorestframework
Step 2: Install the Appointment Scheduler Package
pip install django-appointment-scheduler
Step 3: Create a New Django Project
django-admin startproject tutor_project
cd tutor_project
Step 4: Create a New App
python manage.py startapp main
Step 5: Add the Package to Installed Apps
Edit your settings.py to include the following:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Your app
'main',
# Appointment Scheduler Package
'django_appointment_scheduler',
]
Step 6: Define Your Models (main/models.py)
Create a simple model to test:
from django.db import models
class Tutor(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
Step 7: Make Migrations and Migrate
python manage.py makemigrations main
python manage.py makemigrations django_appointment_scheduler
python manage.py migrate
Step 8: Set Up URLs (tutor_project/urls.py)
Include the package URLs:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('django_appointment_scheduler.urls')), # Include package URLs
]
Step 9: Run the Server
python manage.py runserver
Step 10: Create Tutor Instances via the Shell
python manage.py shell
from main.models import Tutor
# Create some tutors
Tutor.objects.create(name="Dr. John Doe")
Tutor.objects.create(name="Dr. Jane Smith")
# Check if they are created
print(Tutor.objects.all())
📝 API Usage
Set Availability for a Tutor
You can pass list into weekly_offs
curl -X POST http://localhost:8000/api/tutor/1/set-availability/ \
-H "Content-Type: application/json" \
-d '{
"start_date": "2025-03-24",
"end_date": "2025-03-31",
"start_time": "10:00:00",
"end_time": "15:00:00",
"slot_duration": 30,
"weekly_offs": ["Sunday"]
}'
You can set the entire date range as Off by using the keyword “Off” in the weekly_offs list. This is useful when you want to mark a period as completely unavailable.
"weekly_offs": ["Off"]
Additionally, you can pass multiple weekdays to the weekly_offs list to mark specific days of the week as unavailable.
"weekly_offs": ["Sunday", "Friday"]
Book an Appointment
curl -X POST http://localhost:8000/api/tutor/1/book-appointment/1/ \
-H "Content-Type: application/json" \
-d '{
"customer_name": "Alice Johnson",
"booked_by": "Admin"
}'
Cancel an Appointment
curl -X DELETE http://localhost:8000/api/tutor/1/cancel-appointment/1/
📝 Notes
For a more detailed and engaging read, check out my Medium article: Introducing the Django Appointment Scheduler - Your Ultimate Solution for Managing Appointments
🎉 Done!
Your Django Appointment Scheduler is up and running! You can now manage tutor appointments seamlessly.
Metadata
Release files for django-appointment-scheduler 0.1.6
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 |
|---|---|---|---|---|
| django_appointment_scheduler-0.1.6.tar.gz | 8.7 kB | Without provenance | Details for django_appointment_scheduler-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_appointment_scheduler-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for django_appointment_scheduler-0.1.6-py3-none-any.whl |
Total release size: 17.3 kB
Release files / django_appointment_scheduler-0.1.6.tar.gz
| Download URL | django_appointment_scheduler-0.1.6.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb6cf9483b975d7120345bfaec512de5d4dd6603b4143f2f9536902dce21d1e2
|
|
BLAKE2b-256 checksum How to use checksums |
6a2bf0fefb6189ec3b35ba09dbe7458b99ec507a4f82cffac4dc1c946df7e22d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / django_appointment_scheduler-0.1.6-py3-none-any.whl
| Download URL | django_appointment_scheduler-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4de436a8c31b09afdd16a6724684bc0d730672e679dfb1956fa55c5d12778b08
|
|
BLAKE2b-256 checksum How to use checksums |
fd94275e9f11d26b845a7865f452ff2cf8a6572e60cb5174648aaaa8cf3b99db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for django-appointment-scheduler 0.1.6
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.