diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index eae1cef..e67bd62 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 9449abe..f58ff9d 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 6d4fdfd..028cede 100644 --- a/config/settings.py +++ b/config/settings.py @@ -43,6 +43,8 @@ SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SESSION_COOKIE_SAMESITE = "None" CSRF_COOKIE_SAMESITE = "None" +LANGUAGE_COOKIE_SAMESITE = "None" +LANGUAGE_COOKIE_SECURE = True # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ diff --git a/config/urls.py b/config/urls.py index 9cb6c91..c0f2fb9 100644 --- a/config/urls.py +++ b/config/urls.py @@ -5,9 +5,10 @@ from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), + path('i18n/', include('django.conf.urls.i18n')), path('', include('core.urls')), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) - urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file + urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index 76092ac..3c262bf 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 1db7bb5..6643cc2 100644 --- a/core/admin.py +++ b/core/admin.py @@ -101,3 +101,12 @@ class PackageAdmin(ActionsModelAdmin): list_editable = ('is_active',) filter_horizontal = ('subjects',) search_fields = ('name_en', 'name_ar') + + class Media: + js = ('js/admin_package.js',) + + def get_form(self, request, obj=None, **kwargs): + form = super().get_form(request, obj, **kwargs) + if obj and obj.classroom: + form.base_fields['subjects'].queryset = Subject.objects.filter(classroom=obj.classroom) + return form \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 8130aff..e1a70db 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,14 +1,18 @@ {% load i18n static %} +{% get_current_language as LANGUAGE_CODE %} - +
-- منصة تعليمية متكاملة تدعم الطلاب والمعلمين مع دروس حية ومصادر تعليمية متميزة. + {% if LANGUAGE_CODE == 'ar' %} + منصة تعليمية متكاملة تدعم الطلاب والمعلمين مع دروس حية ومصادر تعليمية متميزة. + {% else %} + A comprehensive educational platform supporting students and teachers with live lessons and premium resources. + {% endif %}
انضم لآلاف الطلاب اليوم.
++ {% if LANGUAGE_CODE == 'ar' %}انضم لآلاف الطلاب اليوم.{% else %}Join thousands of students today.{% endif %} +
استكشف المواد المخصصة لكل مرحلة دراسية.
++ {% if LANGUAGE_CODE == 'ar' %}استكشف المواد المخصصة لكل مرحلة دراسية.{% else %}Explore subjects tailored for each educational level.{% endif %} +
- {{ subject.description_ar|truncatewords:15 }} + {% if LANGUAGE_CODE == 'ar' %} + {{ subject.description_ar|truncatewords:15 }} + {% else %} + {{ subject.description_en|default:subject.description_ar|truncatewords:15 }} + {% endif %}
تعلم من نخبة من المعلمين.
++ {% if LANGUAGE_CODE == 'ar' %}تعلم من نخبة من المعلمين.{% else %}Learn from elite educators.{% endif %} +
{{ teacher.specialization|default:"معلم" }}
- {{ teacher.bio|default:"لا توجد نبذة."|truncatewords:20 }} + {{ teacher.bio|default:"No bio available."|truncatewords:20 }}
لا يوجد معلمين حالياً.
++ {% if LANGUAGE_CODE == 'ar' %}لا يوجد معلمين حالياً.{% else %}No teachers available at the moment.{% endif %} +
انضم لجلسات تفاعلية عبر Google Meet.
++ {% if LANGUAGE_CODE == 'ar' %}انضم لجلسات تفاعلية عبر Google Meet.{% else %}Join interactive sessions via Google Meet.{% endif %} +
الوصول لمواد الدورة عبر Google Drive.
++ {% if LANGUAGE_CODE == 'ar' %}الوصول لمواد الدورة عبر Google Drive.{% else %}Access course materials via Google Drive.{% endif %} +
دفع آمن عبر بوابة ثواني.
++ {% if LANGUAGE_CODE == 'ar' %}دفع آمن عبر بوابة ثواني.{% else %}Secure payment via Thawani Gateway.{% endif %} +
سجل الدخول لمتابعة رحلتك التعليمية
++ {% if LANGUAGE_CODE == 'ar' %}سجل الدخول لمتابعة رحلتك التعليمية{% else %}Login to continue your educational journey{% endif %} +