Skip to content

Commit 98bb26a

Browse files
authored
Minor fixes & documentations (#60)
* Small fixes * CSS fixes and some refactoring * Updated CSS Added service views * Updated documentation & fixed a few incoherences * appointment request screenshot (#58) * updated models.md * Updated models and readme * Screenshots (#59) * Added offered by screenshot * Updated documentation & models * Updated documentation & fixed failing tests * Fixed get_locale failing test * Fixed TestStaffMemberTimeFunctions appointment_buffer_time null error failing test * Fixed appointment_buffer_time error
1 parent 1c79ac5 commit 98bb26a

Some content is hidden

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

53 files changed

+600
-453
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ Pull requests are the best way to propose changes to the codebase. We actively w
2424

2525
## Any contributions you make will be under the Software License
2626

27-
In short, when you submit code changes, your submissions are understood to be under the same [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0) that covers the project. Feel free to contact the maintainers if that's a concern.
27+
In short, when you submit code changes, your submissions are understood to be under the
28+
same [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0) that covers the project. Feel free to contact us
29+
if that's a concern.
2830

2931
## Report bugs using Github's [issues](https://github.com/adamspd/django-appointment/issues)
3032

31-
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/adamspd/django-appointment/issues/new); it's that easy!
33+
We use GitHub issues to track public bugs. Report a bug
34+
by [opening a new issue](https://github.com/adamspd/django-appointment/issues/new); it's that easy!
3235

3336
## Write bug reports with detail, background, and sample code
3437

3538
**Great Bug Reports** tend to have:
3639

3740
- A quick summary and/or background
3841
- Steps to reproduce
39-
- Be specific!
40-
- Give sample code if you can.
42+
- Be specific!
43+
- Give sample code if you can.
4144
- What you expected would happen
4245
- What actually happens
4346
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
@@ -51,4 +54,5 @@ People *love* thorough bug reports.
5154

5255
## License
5356

54-
By contributing, you agree that your contributions will be licensed under its [Apache 2.0 License](https://github.com/adamspd/django-appointment/LICENSE).
57+
By contributing, you agree that your contributions will be licensed under
58+
its [Apache 2.0 License](https://github.com/adamspd/django-appointment/LICENSE).

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
[![GitHub pull requests](https://img.shields.io/github/issues-pr/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/pulls)
1212
[![GitHub contributors](https://img.shields.io/github/contributors/adamspd/django-appointment)](https://github.com/adamspd/django-appointment/graphs/contributors)
1313

14-
⚠️ **IMPORTANT**: If upgrading from a version before 2.0.0, please note significant database changes were introduced in
14+
⚠️ **IMPORTANT**: If upgrading from a version before 2.x.x, please note significant database changes were introduced in
1515
Version 2.0.0 introduces significant database changes. Please read
1616
the [migration guide](https://github.com/adamspd/django-appointment/tree/main/docs/migration_guides/v2_1_0.md) before
17-
updating.
17+
updating. No significant database changes were introduced in version 3.0.0.
1818

1919
Django-Appointment is a Django app engineered for managing appointment scheduling with ease and flexibility. It enables
2020
users to define custom configurations for time slots, lead time, and finish time, or utilize the default values
@@ -31,32 +31,37 @@ notes](https://github.com/adamspd/django-appointment/tree/main/docs/release_note
3131
1. Customizable time slots, lead time, and finish time.
3232
2. Competent handling of appointment conflicts and availability.
3333
3. Seamless integration with the Django admin interface for appointment management.
34-
4. User-friendly interface for viewing available time slots and scheduling appointments.
35-
5. Capability to send email notifications to clients upon scheduling an appointment.
34+
4. Custom admin interface for managing appointment/staff member editing, creation, availability, and conflicts.
35+
5. User-friendly interface for viewing available time slots and scheduling appointments.
36+
6. Capability to send email notifications to clients upon scheduling an appointment.
3637

3738
## Key features introduced in previous versions.
3839

3940
- For more information, please refer to
4041
this [documentation](https://github.com/adamspd/django-appointment/tree/main/docs/history/readme_v2_1_1.md).
4142

42-
## Added Features in version 2.1.5
43+
## Added Features in version 3.0.0
4344

4445
This release of Django Appointment brings a series of improvements and updates aimed at enhancing the overall
4546
functionality and user experience:
4647

47-
1. **Dynamic Label Customization in Appointment Pages (#19)**
48+
1. **Dynamic Appointment Management (#49, #55)**
4849

49-
2. **Updated Documentation and Workflow Enhancements (#25, #26, #27)**
50+
2. **User Interface Enhancements and JavaScript Refactoring (#55)**
5051

51-
3. **Community Engagement and Standards (#21, #22, #23, #24)**
52+
3. **Dynamic Label Customization in Appointment Pages (#19)**
5253

53-
4. **Library Updates and Security Patches (#14, #15, #18)**
54+
4. **Updated Documentation and Workflow Enhancements (#25, #26, #27)**
5455

55-
5. **Enhanced Project Visibility (#16)**
56+
5. **Community Engagement and Standards (#21, #22, #23, #24)**
5657

57-
6. **Translation Refinements (#31)**
58+
6. **Library Updates and Security Patches (#14, #15, #18)**
5859

59-
7. **Bug Fixes (#48)**
60+
7. **Enhanced Project Visibility (#16)**
61+
62+
8. **Translation Refinements (#31)**
63+
64+
9. **Bug Fixes (#48)**
6065

6166
See more at the [release notes](https://github.com/adamspd/django-appointment/tree/main/docs/release_notes/latest.md).
6267

@@ -68,10 +73,10 @@ our commitment to providing a high-quality and user-friendly appointment managem
6873
See the [release notes](https://github.com/adamspd/django-appointment/tree/main/docs/release_notes/latest.md)
6974
for more information.
7075

71-
### Breaking Changes in version 2.1.5:
72-
73-
- None
76+
### Breaking Changes in version 3.0.0:
7477

78+
See the [release notes](https://github.com/adamspd/django-appointment/tree/main/docs/release_notes/latest.md) for more
79+
information.
7580

7681
## Quick Start 🚀
7782

@@ -178,7 +183,10 @@ information.
178183

179184
## Notes 📝⚠️
180185

181-
Currently, the application does not send email reminders yet.
186+
Currently, the application does not send email reminders yet. I'm also working on a testing website for the application
187+
that is not fully functional yet, no hard feelings. But you can check it out
188+
at [https://django-appt.adamspierredavid.com/](https://django-appt.adamspierredavid.com/). Ideas are welcome here since
189+
I'm blocked on a few points.
182190

183191
## About the Author
184192

SECURITY.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,34 @@
33
## Supported Versions
44

55
| Version | Supported |
6-
| ------- | ------------------ |
6+
|---------|--------------------|
77
| 2.x.x | :white_check_mark: |
88
| < 2.0 | :x: |
99

1010
## Reporting a Vulnerability
1111

12-
The security of our project is a top priority. If you believe you have found a security vulnerability in Django-Appointment, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem. Please follow these steps to report a vulnerability:
12+
The security of this project is a top priority. If you believe you have found a security vulnerability in
13+
Django-Appointment, we encourage you to let me know right away. We will investigate all legitimate reports and do our best
14+
to quickly fix the problem. Please follow these steps to report a vulnerability:
1315

1416
1. **Do Not Publicly Disclose the Vulnerability**:
15-
- Please do not publicly disclose the vulnerability until it has been handled by the security team.
17+
- Please do not publicly disclose the vulnerability until it has been handled.
1618

1719
2. **Contact Us Privately**:
18-
- Send a detailed report to [this contact page](https://adamspierredavid.com/contact/).
19-
- Include the affected versions and any other information that might be relevant.
20+
- Send a detailed report to [this contact page](https://adamspierredavid.com/contact/)
21+
or [create a new issue here](https://github.com/adamspd/django-appointment/issues/new/choose).
22+
- Include the affected versions and any other information that might be relevant.
2023

2124
3. **Wait for Initial Response**:
22-
- We aim to respond to your report within 48 hours with our next steps.
25+
- We aim to respond to your report within 48 hours with the next steps.
2326

2427
4. **Coordinated Disclosure**:
25-
- We will work with you to ensure we understand the scope of the issue and will arrange a coordinated disclosure plan.
28+
- We will work with you to ensure we understand the scope of the issue and will arrange a coordinated disclosure
29+
plan.
2630

2731
## Dependencies
2832

29-
Our project depends on several third-party libraries:
33+
This project depends on several third-party libraries:
3034

3135
- Django==4.2.7
3236
- Pillow==10.1.0
@@ -35,7 +39,8 @@ Our project depends on several third-party libraries:
3539
- babel==2.13.1
3640
- pytz~=2023.3.post1
3741

38-
We strive to keep these dependencies up-to-date and free from vulnerabilities. If you find a vulnerability in one of these dependencies, please follow the steps above to report it.
42+
We strive to keep these dependencies up to date and free from vulnerabilities. If you find a vulnerability in one of
43+
these dependencies, please follow the steps above to report it.
3944

4045
## Policy Updates
4146

appointment/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
__description__ = "Managing appointment scheduling with customizable slots, staff features, and conflict handling."
55
__package_name__ = "django-appointment"
66
__url__ = "https://github.com/adamspd/django-appointment"
7-
__version__ = "2.1.5"
7+
__version__ = "3.0.0"
88
__test_version__ = True

appointment/admin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
from django import forms
1010
from django.contrib import admin
1111

12-
from .models import Service, AppointmentRequest, Appointment, EmailVerificationCode, Config, StaffMember, DayOff, \
13-
WorkingHours
14-
from appointment.utils.db_helpers import get_user_model
12+
from .models import (
13+
Appointment, AppointmentRequest, Config, DayOff, EmailVerificationCode, Service, StaffMember, WorkingHours)
1514

1615

1716
@admin.register(Service)

appointment/decorators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from functools import wraps
1010

11-
from django.http import JsonResponse
12-
1311
from appointment.utils.error_codes import ErrorCode
1412
from appointment.utils.json_context import json_response
1513
from appointment.utils.view_helpers import is_ajax
@@ -19,6 +17,7 @@ def require_user_authenticated(func):
1917
"""Decorator to require a user to be authenticated.
2018
Usage: @require_user_authenticated
2119
"""
20+
2221
@wraps(func)
2322
def wrapper(request, *args, **kwargs):
2423
if not request.user.is_authenticated:
@@ -32,6 +31,7 @@ def require_staff_or_superuser(func):
3231
"""Decorator to require a user to be a staff or superuser.
3332
Usage: @require_staff_or_superuser
3433
"""
34+
3535
@wraps(func)
3636
def wrapper(request, *args, **kwargs):
3737
if not (request.user.is_staff or request.user.is_superuser):
@@ -45,6 +45,7 @@ def require_superuser(func):
4545
"""Decorator to require a user to be a superuser.
4646
Usage: @require_superuser
4747
"""
48+
4849
@wraps(func)
4950
def wrapper(request, *args, **kwargs):
5051
if not request.user.is_superuser:
@@ -58,6 +59,7 @@ def require_ajax(func):
5859
"""Decorator to require a request to be AJAX.
5960
Usage: @require_ajax
6061
"""
62+
6163
@wraps(func)
6264
def wrapper(request, *args, **kwargs):
6365
if not is_ajax(request):

appointment/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from phonenumber_field.formfields import PhoneNumberField
1212
from phonenumber_field.widgets import PhoneNumberPrefixWidget
1313

14-
from .models import AppointmentRequest, Appointment, WorkingHours, DayOff, StaffMember, Service
14+
from .models import Appointment, AppointmentRequest, DayOff, Service, StaffMember, WorkingHours
1515
from .utils.db_helpers import get_user_model
1616

1717

appointment/models.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def get_down_payment(self):
145145
else:
146146
return self.down_payment # Return the original float value
147147

148-
def get_down_payment_str(self):
148+
def get_down_payment_text(self):
149149
if self.down_payment == 0:
150150
return f"Free"
151151
return f"{self.get_down_payment()}{self.get_currency_icon()}"
@@ -178,7 +178,7 @@ class StaffMember(models.Model):
178178
help_text=_("Time when the staff member stops working.")
179179
)
180180
appointment_buffer_time = models.FloatField(
181-
null=True,
181+
blank=True, null=True,
182182
help_text=_("Time between now and the first available slot for the current day (doesn't affect tomorrow). "
183183
"e.g: If you start working at 9:00 AM and the current time is 8:30 AM and you set it to 30 "
184184
"minutes, the first available slot will be at 9:00 AM. If you set the appointment buffer time to "
@@ -198,7 +198,7 @@ def get_slot_duration(self):
198198
config = Config.objects.first()
199199
return self.slot_duration or (config.slot_duration if config else 0)
200200

201-
def get_slot_duration_str(self):
201+
def get_slot_duration_text(self):
202202
slot_duration = self.get_slot_duration()
203203
return convert_minutes_in_human_readable_format(slot_duration)
204204

@@ -232,7 +232,7 @@ def get_non_working_days(self):
232232
non_working_days.append(0) # Sunday
233233
return non_working_days
234234

235-
def get_weekend_days_worked_str(self):
235+
def get_weekend_days_worked_text(self):
236236
if self.work_on_saturday and self.work_on_sunday:
237237
return _("Saturday and Sunday")
238238
elif self.work_on_saturday:
@@ -245,14 +245,14 @@ def get_weekend_days_worked_str(self):
245245
def get_services_offered(self):
246246
return self.services_offered.all()
247247

248-
def get_service_offered_str(self):
248+
def get_service_offered_text(self):
249249
return ', '.join([service.name for service in self.services_offered.all()])
250250

251251
def get_appointment_buffer_time(self):
252252
config = Config.objects.first()
253253
return self.appointment_buffer_time or (config.appointment_buffer_time if config else 0)
254254

255-
def get_appointment_buffer_time_str(self):
255+
def get_appointment_buffer_time_text(self):
256256
# convert buffer time (which is in minutes) in day hours minutes if necessary
257257
return convert_minutes_in_human_readable_format(self.get_appointment_buffer_time())
258258

@@ -458,7 +458,7 @@ def is_paid(self):
458458
return True
459459
return self.paid
460460

461-
def is_paid_txt(self):
461+
def is_paid_text(self):
462462
return _("Yes") if self.is_paid() else _("No")
463463

464464
def get_appointment_amount_to_pay(self):
@@ -468,7 +468,7 @@ def get_appointment_amount_to_pay(self):
468468
else:
469469
return self.amount_to_pay # Return the original float value
470470

471-
def get_appointment_amount_to_pay_str(self):
471+
def get_appointment_amount_to_pay_text(self):
472472
if self.amount_to_pay == 0:
473473
return "Free"
474474
return f"{self.get_appointment_amount_to_pay()}{self.get_service().get_currency_icon()}"
@@ -625,6 +625,9 @@ class PaymentInfo(models.Model):
625625
def __str__(self):
626626
return f"{self.appointment.get_service_name()} - {self.appointment.get_service_price()}"
627627

628+
def __repr__(self):
629+
return f"{self.appointment.get_service_name()} - {self.appointment.get_service_price()}"
630+
628631
def get_id_request(self):
629632
return self.appointment.get_appointment_id_request()
630633

appointment/services.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ def create_staff_member_service(post_data):
515515
}
516516
user = create_new_user(client_data=user_data)
517517
StaffMember.objects.create(user=user)
518+
if not user.is_superuser:
519+
user.is_staff = True
520+
user.save()
518521
return user, True, None
519522
else:
520523
return None, False, get_error_message_in_form(form=form)

appointment/static/css/app_admin/admin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Hide scrollbar for day grid month view on small screens */
22

3-
@media (max-width: 500px) {
3+
@media (max-width: 767px) {
44
.djangoAppt_no-events {
55
margin-bottom: 10px;
66
}

0 commit comments

Comments
 (0)