2024-09-10 13:50:54 +05:30
|
|
|
"""
|
|
|
|
|
This module defines the configuration for the 'attendance' app within the Horilla HRMS project.
|
|
|
|
|
"""
|
|
|
|
|
|
2023-05-10 15:06:57 +05:30
|
|
|
from django.apps import AppConfig
|
|
|
|
|
|
2024-09-30 14:31:06 +05:30
|
|
|
from horilla.horilla_settings import APP_URLS
|
|
|
|
|
|
2023-05-10 15:06:57 +05:30
|
|
|
|
|
|
|
|
class AttendanceConfig(AppConfig):
|
2024-09-10 13:50:54 +05:30
|
|
|
"""
|
|
|
|
|
Configures the 'attendance' app and performs additional setup during the app's
|
|
|
|
|
initialization. This includes appending the 'attendance' URL patterns to the
|
|
|
|
|
project's main urlpatterns and dynamically adding the 'AttendanceMiddleware'
|
|
|
|
|
to the middleware stack if it's not already present.
|
|
|
|
|
"""
|
|
|
|
|
|
2024-03-10 19:37:46 +05:30
|
|
|
default_auto_field = "django.db.models.BigAutoField"
|
|
|
|
|
name = "attendance"
|
2024-08-05 14:22:44 +05:30
|
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
|
from django.urls import include, path
|
|
|
|
|
|
2024-08-16 10:20:58 +05:30
|
|
|
from horilla.settings import MIDDLEWARE
|
2024-08-05 14:22:44 +05:30
|
|
|
from horilla.urls import urlpatterns
|
|
|
|
|
|
|
|
|
|
urlpatterns.append(
|
|
|
|
|
path("attendance/", include("attendance.urls")),
|
|
|
|
|
)
|
2024-08-16 10:20:58 +05:30
|
|
|
middleware_path = "attendance.middleware.AttendanceMiddleware"
|
|
|
|
|
if middleware_path not in MIDDLEWARE:
|
|
|
|
|
MIDDLEWARE.append(middleware_path)
|
|
|
|
|
|
2024-09-30 14:31:06 +05:30
|
|
|
APP_URLS.append("attendance.urls") # Used to remove Dynamically Added Urls
|
|
|
|
|
|
2024-08-05 14:22:44 +05:30
|
|
|
super().ready()
|