Skip to content

Commit 493932e

Browse files
authored
Staff functionality with admin interface (#7)
* Added staff functionality Admin interface Slot availability Extensive documentation GitHub workflow Extensive tests * updated publish workflow
1 parent c3fb2c7 commit 493932e

File tree

115 files changed

+10452
-1814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+10452
-1814
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload Python Package to PyPI on Push to Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine requests # Added requests for the version check
25+
26+
# Check if the current version is already on PyPI
27+
- name: Check version on PyPI
28+
run: |
29+
python check_version.py # This script now checks against real PyPI
30+
31+
# Build the package (folder exclusion is handled by MANIFEST.in)
32+
- name: Build package
33+
run: |
34+
python setup.py sdist bdist_wheel
35+
36+
- name: Upload to PyPI
37+
env:
38+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
39+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
40+
run: |
41+
twine upload dist/*

.github/workflows/tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Testing workflow
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'main'
7+
workflow_dispatch:
8+
9+
jobs:
10+
running_tests:
11+
runs-on: ubuntu-20.04
12+
strategy:
13+
max-parallel: 4
14+
matrix:
15+
python-version: [3.10.5]
16+
fail-fast: [false]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install Dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install coverage
29+
- name: Run Tests
30+
run: |
31+
coverage run --source=appointment manage.py test appointment.tests --verbosity=1
32+
coverage report

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,6 @@ cython_debug/
173173
# and can be added to the global gitignore or merged into this file. For a more nuclear
174174
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
175175
.idea/
176-
.DS_Store
176+
.DS_Store
177+
**/.DS_Store/**
178+
**/migrations/**

MANIFEST.in

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,49 @@
1+
# Include files
12
include LICENSE
23
include README.md
3-
recursive-include appointment/templates/appointment *.html
4-
recursive-include appointment/templates/base_templates *.html
5-
recursive-include appointment/templates/email_sender *.html
4+
include requirements.txt
5+
include setup.cfg
6+
include setup.py
7+
include pyproject.toml
8+
include MANIFEST.in
9+
10+
# Include appointment main files
11+
include appointment/__init__.py
12+
include appointment/admin.py
13+
include appointment/apps.py
14+
include appointment/decorators.py
15+
include appointment/email_messages.py
16+
include appointment/forms.py
17+
include appointment/logger_config.py
18+
include appointment/models.py
19+
include appointment/services.py
20+
include appointment/settings.py
21+
include appointment/urls.py
22+
include appointment/views.py
23+
include appointment/views_admin.py
24+
25+
# Recursive includes
26+
recursive-include appointment/email_sender *.py
627
recursive-include appointment/static/css *.css
728
recursive-include appointment/static/js *.js
829
recursive-include appointment/static/img *.jpg
9-
recursive-include appointment/email_sender *.py
30+
recursive-include appointment/templates/ *.html
1031
recursive-include appointment/tests *.py
11-
recursive-include appointment *.py
12-
recursive-include docs *
13-
include logger_config.py
14-
include release_notes.md
15-
exclude appointment/__pycache__
32+
recursive-include appointment/utils *.py
33+
34+
# Exclusions
35+
exclude release_notes.md
36+
exclude check_version.py
37+
exclude manage.py
38+
exclude db.sqlite3
39+
exclude .gitignore
40+
exclude .git
41+
exclude .svn
42+
exclude .hg
43+
exclude appointment/__pycache__
44+
exclude appointment/migrations/__pycache__
45+
46+
# Recursive exclusions
47+
recursive-exclude appointment/migrations *.py
48+
recursive-exclude appointments *.py
49+
recursive-exclude appointment *.pyc

README.md

Lines changed: 71 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1-
# Django Appointment
1+
# Django Appointment 📦
22

3-
Django-Appointment is a Django app designed for managing appointment scheduling with ease and flexibility. It allows
4-
users to define custom configurations for time slots, lead time, and finish time, or use the default values provided.
5-
The app also handles conflicts and availability for appointments, ensuring a smooth user experience.
3+
⚠️ **IMPORTANT**: Version 2.0.0 introduces significant database changes. Please read the [migration guide](https://github.com/adamspd/django-appointment/tree/main/migration_guide_v2.0.0.md) before updating.
64

7-
Detailed documentation is in the ["docs"](https://github.com/adamspd/django-appointment/tree/main/docs) directory.
8-
Please refer to the release notes for changes and migration
9-
information [here](https://github.com/adamspd/django-appointment/tree/main/release_notes.md).
5+
Django-Appointment is a Django app engineered for managing appointment scheduling with ease and flexibility. It enables
6+
users to define custom configurations for time slots, lead time, and finish time, or utilize the default values
7+
provided. This app proficiently manages conflicts and availability for appointments, ensuring a seamless user
8+
experience.
109

11-
## Features
10+
Detailed documentation can be found in the [docs](https://github.com/adamspd/django-appointment/tree/main/docs)
11+
directory.
12+
For changes and migration information, please refer to the release
13+
notes [here](https://github.com/adamspd/django-appointment/tree/main/release_notes.md).
14+
15+
## Features ✨
1216

1317
1. Customizable time slots, lead time, and finish time.
14-
2. Handles appointment conflicts and availability.
15-
3. Easy integration with Django admin interface for appointment management.
18+
2. Competent handling of appointment conflicts and availability.
19+
3. Seamless integration with the Django admin interface for appointment management.
1620
4. User-friendly interface for viewing available time slots and scheduling appointments.
17-
5. Send email notifications to clients when they schedule an appointment.
21+
5. Capability to send email notifications to clients upon scheduling an appointment.
22+
23+
## Added Features in version 2.0.0 🆕
24+
- **Database Changes ⚠️**: Significant modifications to the database schema. Before updating, ensure you follow the migration steps outlined in the [migration guide](https://github.com/adamspd/django-appointment/tree/main/migration_guide_v2.0.0.md).
25+
1. Introduced a staff feature allowing staff members in a team or system to manage their own appointments.
26+
2. Implemented an admin feature panel enabling staff members and superusers (admins) to manage the system.
27+
3. Added buffer time between the current time and the first available slot for the day.
28+
4. Defined working hours for each staff member, along with the specific days they are available during the week.
29+
5. Specified days off for staff members to represent holidays or vacations.
30+
6. Staff members can now define their own configuration settings for the appointment system, such as slot duration,
31+
working hours, and buffer time between appointments. However, only admins have the privilege to add/remove services.
1832

19-
## Quick start
33+
## Quick Start 🚀
2034

21-
1. Add "appointment" to your INSTALLED_APPS setting like this:
35+
1. Add "appointment" to your `INSTALLED_APPS` setting like so:
2236

2337
```python
2438
INSTALLED_APPS = [
@@ -27,7 +41,7 @@ information [here](https://github.com/adamspd/django-appointment/tree/main/relea
2741
]
2842
```
2943

30-
2. Include the appointment URLconf in your project urls.py like this:
44+
2. Incorporate the appointment URLconf in your project's `urls.py` like so:
3145

3246
```python
3347
from django.urls import path, include
@@ -38,92 +52,71 @@ information [here](https://github.com/adamspd/django-appointment/tree/main/relea
3852
]
3953
```
4054

41-
3. In your Django's settings.py, add the following:
55+
3. In your Django's `settings.py`, append the following:
4256

4357
```python
44-
APPOINTMENT_CLIENT_MODEL = models.UserModel # Not optional (e.g. auth.User, or client.UserClient)
58+
AUTH_USER_MODEL = 'models.UserModel' # Optional if you use Django's user model
4559
```
46-
47-
For example, if you use the default Django user model:
48-
60+
61+
For instance, if you employ a custom user model:
62+
4963
```python
50-
APPOINTMENT_CLIENT_MODEL = auth.User
64+
AUTH_USER_MODEL = 'client.UserClient'
5165
```
52-
53-
Or, if you use a custom user model:
54-
66+
67+
If you're utilizing the default Django user model, there's no need to add this line since Django automatically sets it
68+
to:
69+
5570
```python
56-
APPOINTMENT_CLIENT_MODEL = client.UserClient
71+
AUTH_USER_MODEL = 'auth.User'
5772
```
58-
59-
If you have a custom user model, make sure your create_user function includes the following arguments, even if you
60-
don't use all of them:
61-
73+
74+
Ensure your `create_user` function includes the following arguments, even if they are not all utilized:
75+
6276
```python
63-
def create_user(first_name, email, username, **extra_fields):
77+
def create_user(first_name, email, username, last_name=None, **extra_fields):
6478
pass
6579
```
66-
67-
This will create a user with a password in the format: f"{APPOINTMENT_WEBSITE_NAME}{current_year}"
68-
69-
For example, if you add this to your settings.py:
70-
80+
81+
This function will create a user with a password formatted as: f"{APPOINTMENT_WEBSITE_NAME}{current_year}"
82+
83+
For instance, if you append this to your `settings.py`:
84+
7185
```python
7286
APPOINTMENT_WEBSITE_NAME = 'Chocolates'
7387
```
74-
75-
And the current year is 2023, the password will be "Chocolates2023". If you don't provide an
76-
APPOINTMENT_WEBSITE_NAME, the default value is "Website", so the password will be "Website2023".
77-
78-
This name is also used in the footer of the emails sent to the clients when they schedule an appointment.
88+
89+
And the current year is 2023, the password will be "Chocolates2023". If `APPOINTMENT_WEBSITE_NAME` is not provided, the
90+
default value is "Website", rendering the password as "Website2023".
91+
92+
This name is also utilized in the footer of the emails sent to clients upon scheduling an appointment:
93+
7994
```html
80-
<p>® 2023 {{ APPOINTMENT_WEBSITE_NAME }}. All Right Reserved.</p>
95+
<p>® 2023 {{ APPOINTMENT_WEBSITE_NAME }}. All Rights Reserved.</p>
8196
```
8297

83-
4. Run `python manage.py migrate` to create the appointment models.
84-
85-
86-
5. Start the development server and visit http://127.0.0.1:8000/admin/
87-
to create appointments, manage configurations, and handle appointment conflicts (you'll need the Admin app enabled).
88-
89-
90-
6. You have to create at least a service before using the application in the admin page. If your service is free, add 0
91-
as the price. If you want to charge for your service, add the price in the price field. You can also add a
92-
description for your service.
93-
98+
4. Execute `python manage.py migrate` to create the appointment models.
99+
5. Launch the development server and navigate to http://127.0.0.1:8000/admin/ to create appointments, manage
100+
configurations, and handle appointment conflicts (the Admin app must be enabled).
101+
6. You must create at least one service before using the application on the admin page. If your service is free, input 0
102+
as the price. If your service is paid, input the price in the price field. You may also provide a description for
103+
your service.
94104
7. Visit http://127.0.0.1:8000/appointment/request/<service_id>/ to view the available time slots and schedule an
95105
appointment.
96106

97-
## Customization
98-
99-
1. In your Django project's settings.py, you can override the default values for the appointment scheduler:
100-
101-
```python
102-
# Default values
103-
APPOINTMENT_SLOT_DURATION = 30 # minutes
104-
APPOINTMENT_LEAD_TIME = (9, 0) # (hour, minute) 24-hour format
105-
APPOINTMENT_FINISH_TIME = (16, 30) # (hour, minute) 24-hour format
106-
107-
# Additional configuration options
108-
APPOINTMENT_BASE_TEMPLATE = 'base_templates/base.html' # your base template
109-
APPOINTMENT_WEBSITE_NAME = 'Website'
110-
APPOINTMENT_PAYMENT_URL = None # example of pattern 'payment:payment_linked
111-
APPOINTMENT_THANK_YOU_URL = None # example of pattern 'payment:thank_you'
112-
113-
# Additional to the default email settings
114-
APP_DEFAULT_FROM_EMAIL = "webmaster@localhost" # the default from email that you're using
115-
```
116-
117-
2. Modify these values as needed for your application, and the scheduler will adapt to the new settings.
107+
## Customization 🔧
118108

119-
3. To further customize the app, you can extend the provided models, views, and templates or create your own.
109+
1. In your Django project's `settings.py`, you can override the default values for the appointment scheduler. More
110+
information regarding available configurations can be found in the
111+
documentation [here](docs/README.md#configuration).
112+
2. Modify these values as needed for your application, and the app will adapt to the new settings.
113+
3. For further customization, you can extend the provided models, views, and templates or create your own.
120114

121-
## Support
115+
## Support 💬
122116

123-
For support or questions regarding the Appointment Scheduler app, please refer to the documentation in the "docs"
117+
For support or inquiries regarding the Appointment Scheduler app, please refer to the documentation in the "docs"
124118
directory or visit the GitHub repository for more information.
125119

126-
## Notes
120+
## Notes 📝⚠️
127121

128-
The application doesn't send confirmation emails on appointment creation yet, but it will be implemented soon.
129-
Also the application doesn't send email reminders yet.
122+
Currently, the application does not send email reminders yet.

0 commit comments

Comments
 (0)