|
|
@ -9,6 +9,7 @@ from django.urls import reverse_lazy |
|
|
import environ |
|
|
import environ |
|
|
from django.utils.translation import gettext_lazy as _ |
|
|
from django.utils.translation import gettext_lazy as _ |
|
|
import sentry_sdk |
|
|
import sentry_sdk |
|
|
|
|
|
from corsheaders.defaults import default_headers |
|
|
|
|
|
|
|
|
# Build paths inside the project: BASE_DIR / 'subdir'. |
|
|
# Build paths inside the project: BASE_DIR / 'subdir'. |
|
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent |
|
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent |
|
|
@ -23,7 +24,7 @@ SECRET_KEY = env('DJANGO_SECRET_KEY', default='django-insecure-template-secret-k |
|
|
DEBUG = env.bool('DJANGO_DEBUG', default=True) |
|
|
DEBUG = env.bool('DJANGO_DEBUG', default=True) |
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = [host.strip() for host in env('DJANGO_ALLOWED_HOSTS', default='127.0.0.1,localhost,*').split(',') if host.strip()] |
|
|
ALLOWED_HOSTS = [host.strip() for host in env('DJANGO_ALLOWED_HOSTS', default='127.0.0.1,localhost,*').split(',') if host.strip()] |
|
|
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in env('DJANGO_TRUSTED_ORIGINS', default='http://localhost:8000,http://127.0.0.1:8000').split(',') if origin.strip()] |
|
|
|
|
|
|
|
|
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in env('DJANGO_TRUSTED_ORIGINS', default='http://localhost:8000,http://127.0.0.1:8000,http://localhost:8080,http://127.0.0.1:8080,http://localhost:5173,http://127.0.0.1:5173,http://localhost:3000,http://127.0.0.1:3000').split(',') if origin.strip()] |
|
|
|
|
|
|
|
|
X_FRAME_OPTIONS = 'SAMEORIGIN' |
|
|
X_FRAME_OPTIONS = 'SAMEORIGIN' |
|
|
|
|
|
|
|
|
@ -86,11 +87,11 @@ AUTHENTICATION_BACKENDS = [ |
|
|
AUTH_USER_MODEL = "account.User" |
|
|
AUTH_USER_MODEL = "account.User" |
|
|
|
|
|
|
|
|
MIDDLEWARE = [ |
|
|
MIDDLEWARE = [ |
|
|
|
|
|
'corsheaders.middleware.CorsMiddleware', |
|
|
'django.middleware.security.SecurityMiddleware', |
|
|
'django.middleware.security.SecurityMiddleware', |
|
|
'django.middleware.gzip.GZipMiddleware', |
|
|
'django.middleware.gzip.GZipMiddleware', |
|
|
"whitenoise.middleware.WhiteNoiseMiddleware", |
|
|
"whitenoise.middleware.WhiteNoiseMiddleware", |
|
|
'django.contrib.sessions.middleware.SessionMiddleware', |
|
|
'django.contrib.sessions.middleware.SessionMiddleware', |
|
|
'corsheaders.middleware.CorsMiddleware', |
|
|
|
|
|
'django.middleware.locale.LocaleMiddleware', |
|
|
'django.middleware.locale.LocaleMiddleware', |
|
|
'django.middleware.common.CommonMiddleware', |
|
|
'django.middleware.common.CommonMiddleware', |
|
|
'django.middleware.csrf.CsrfViewMiddleware', |
|
|
'django.middleware.csrf.CsrfViewMiddleware', |
|
|
@ -270,12 +271,20 @@ CENTRIFUGO_API_KEY = env('CENTRIFUGO_API_KEY', default='centrifugo_internal_api_ |
|
|
CORS_ALLOW_ALL_ORIGINS = True |
|
|
CORS_ALLOW_ALL_ORIGINS = True |
|
|
CORS_ALLOW_CREDENTIALS = True |
|
|
CORS_ALLOW_CREDENTIALS = True |
|
|
CORS_ALLOWED_ORIGINS = [ |
|
|
CORS_ALLOWED_ORIGINS = [ |
|
|
|
|
|
'http://localhost:8080', |
|
|
|
|
|
'http://127.0.0.1:8080', |
|
|
'http://localhost:5173', |
|
|
'http://localhost:5173', |
|
|
'http://127.0.0.1:5173', |
|
|
'http://127.0.0.1:5173', |
|
|
'http://localhost:3000', |
|
|
'http://localhost:3000', |
|
|
'http://127.0.0.1:3000', |
|
|
'http://127.0.0.1:3000', |
|
|
'https://shiadeepconnect.org', |
|
|
'https://shiadeepconnect.org', |
|
|
] |
|
|
] |
|
|
|
|
|
CORS_ALLOW_HEADERS = list(default_headers) + [ |
|
|
|
|
|
'accept-language', |
|
|
|
|
|
'content-disposition', |
|
|
|
|
|
'x-csrftoken', |
|
|
|
|
|
'x-requested-with', |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
# Internationalization |
|
|
# Internationalization |
|
|
LANGUAGE_CODE = 'en' |
|
|
LANGUAGE_CODE = 'en' |
|
|
@ -315,6 +324,14 @@ LOGIN_URL = "admin:login" |
|
|
LOGIN_REDIRECT_URL = "/admin/" |
|
|
LOGIN_REDIRECT_URL = "/admin/" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def admin_url_generator(request, url_name): |
|
|
|
|
|
from django.urls import reverse |
|
|
|
|
|
try: |
|
|
|
|
|
return reverse(f"admin:{url_name}") |
|
|
|
|
|
except Exception: |
|
|
|
|
|
return "#" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Unfold Admin Interface Settings |
|
|
# Unfold Admin Interface Settings |
|
|
UNFOLD = { |
|
|
UNFOLD = { |
|
|
"SITE_TITLE": _("Admin Portal"), |
|
|
"SITE_TITLE": _("Admin Portal"), |
|
|
@ -365,24 +382,290 @@ UNFOLD = { |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
"title": _("User Management"), |
|
|
|
|
|
|
|
|
"title": _("User & Access Management"), |
|
|
"separator": True, |
|
|
"separator": True, |
|
|
"items": [ |
|
|
"items": [ |
|
|
{ |
|
|
{ |
|
|
"title": _("All Users"), |
|
|
"title": _("All Users"), |
|
|
"icon": "people", |
|
|
|
|
|
|
|
|
"icon": "person", |
|
|
"link": lambda request: admin_url_generator(request, "account_user_changelist"), |
|
|
"link": lambda request: admin_url_generator(request, "account_user_changelist"), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
"title": _("Groups & Permissions"), |
|
|
|
|
|
"icon": "shield", |
|
|
|
|
|
|
|
|
"title": _("Groups & Roles"), |
|
|
|
|
|
"icon": "admin_panel_settings", |
|
|
"link": lambda request: admin_url_generator(request, "auth_group_changelist"), |
|
|
"link": lambda request: admin_url_generator(request, "auth_group_changelist"), |
|
|
"permission": lambda request: request.user.is_staff, |
|
|
"permission": lambda request: request.user.is_staff, |
|
|
}, |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Verification Documents"), |
|
|
|
|
|
"icon": "verified", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "account_verificationdocument_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Login History"), |
|
|
|
|
|
"icon": "history", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "account_loginhistory_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Location History"), |
|
|
|
|
|
"icon": "location_on", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "account_locationhistory_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("User Notifications"), |
|
|
|
|
|
"icon": "notifications", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "account_notification_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Notification Templates"), |
|
|
|
|
|
"icon": "mark_email_read", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "account_notificationtemplate_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Institutions & Profiles"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Institutions"), |
|
|
|
|
|
"icon": "account_balance", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "profiles_institution_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Institution Members"), |
|
|
|
|
|
"icon": "badge", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "profiles_institutionmember_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Historical Timelines"), |
|
|
|
|
|
"icon": "timeline", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "profiles_institutiontimeline_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Media Gallery"), |
|
|
|
|
|
"icon": "perm_media", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "profiles_institutionmedia_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Followers"), |
|
|
|
|
|
"icon": "group_add", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "profiles_institutionfollower_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Content Management (CMS)"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Posts & Articles"), |
|
|
|
|
|
"icon": "article", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_post_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Categories"), |
|
|
|
|
|
"icon": "category", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_postcategory_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Tags"), |
|
|
|
|
|
"icon": "label", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_posttag_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Comments"), |
|
|
|
|
|
"icon": "comment", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_postcomment_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Likes"), |
|
|
|
|
|
"icon": "thumb_up", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_postlike_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Media Assets"), |
|
|
|
|
|
"icon": "photo_library", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "cms_mediaasset_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Projects & Kanban"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Projects"), |
|
|
|
|
|
"icon": "assignment", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "projects_project_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Kanban Tasks"), |
|
|
|
|
|
"icon": "task_alt", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "projects_kanbantask_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Kanban Columns"), |
|
|
|
|
|
"icon": "view_column", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "projects_kanbancolumn_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Project Documents"), |
|
|
|
|
|
"icon": "description", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "projects_projectdocument_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Events & Calendar"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Events"), |
|
|
|
|
|
"icon": "event", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "events_event_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Event Registrations"), |
|
|
|
|
|
"icon": "how_to_reg", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "events_eventregistration_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Meetings & Scheduling"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Meeting Requests"), |
|
|
|
|
|
"icon": "video_camera_front", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "meetings_meetingrequest_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Learning Management (LMS)"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Courses"), |
|
|
|
|
|
"icon": "school", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_course_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Course Modules"), |
|
|
|
|
|
"icon": "view_module", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_coursemodule_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Lessons"), |
|
|
|
|
|
"icon": "menu_book", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_lesson_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Quiz Questions"), |
|
|
|
|
|
"icon": "quiz", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_quizquestion_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Student Enrollments"), |
|
|
|
|
|
"icon": "co_present", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_courseenrollment_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Lesson Progress"), |
|
|
|
|
|
"icon": "trending_up", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_lessonprogress_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Digital Certificates"), |
|
|
|
|
|
"icon": "card_membership", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "lms_digitalcertificate_changelist"), |
|
|
|
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
"title": _("System Settings"), |
|
|
|
|
|
|
|
|
"title": _("Ticketing & Support"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Support Tickets"), |
|
|
|
|
|
"icon": "confirmation_number", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "tickets_ticket_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Ticket Messages"), |
|
|
|
|
|
"icon": "forum", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "tickets_ticketmessage_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Support Inquiries"), |
|
|
|
|
|
"icon": "contact_support", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "api_supportmessage_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Dynamic Forms & Surveys"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Form Definitions"), |
|
|
|
|
|
"icon": "dynamic_form", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "dynamic_forms_formdefinition_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Form Responses"), |
|
|
|
|
|
"icon": "checklist", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "dynamic_forms_formresponse_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Donations & Financials"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Donation Campaigns"), |
|
|
|
|
|
"icon": "volunteer_activism", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "donations_donationcampaign_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Transactions"), |
|
|
|
|
|
"icon": "payments", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "donations_donationtransaction_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Diplomacy & Field Reports"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Representative Reports"), |
|
|
|
|
|
"icon": "public", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "diplomacy_representativereport_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Real-Time Communication"), |
|
|
|
|
|
"separator": True, |
|
|
|
|
|
"items": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Chat Rooms"), |
|
|
|
|
|
"icon": "chat", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "chat_chatroom_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Chat Messages"), |
|
|
|
|
|
"icon": "message", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "chat_chatmessage_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("System & Automation"), |
|
|
"separator": True, |
|
|
"separator": True, |
|
|
"items": [ |
|
|
"items": [ |
|
|
{ |
|
|
{ |
|
|
@ -396,9 +679,19 @@ UNFOLD = { |
|
|
"link": lambda request: admin_url_generator(request, "api_appversion_changelist"), |
|
|
"link": lambda request: admin_url_generator(request, "api_appversion_changelist"), |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
"title": _("Support Inquiries"), |
|
|
|
|
|
"icon": "mail", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "api_supportmessage_changelist"), |
|
|
|
|
|
|
|
|
"title": _("Celery Periodic Tasks"), |
|
|
|
|
|
"icon": "schedule", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "django_celery_beat_periodictask_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Crontab Schedules"), |
|
|
|
|
|
"icon": "alarm", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "django_celery_beat_crontabschedule_changelist"), |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"title": _("Interval Schedules"), |
|
|
|
|
|
"icon": "timer", |
|
|
|
|
|
"link": lambda request: admin_url_generator(request, "django_celery_beat_intervalschedule_changelist"), |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
|