Skip to content

Commit 704e6a6

Browse files
committed
add chat
1 parent f7d4771 commit 704e6a6

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ run:
1212
cd landing_page; DEBUG=1 python manage.py runserver
1313
shell:
1414
cd landing_page; DEBUG=1 python manage.py shell
15+
migrate:
16+
cd landing_page; DEBUG=1 python manage.py migrate

landing_page/landing_page/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'django.contrib.sitemaps',
2424

2525
'memoize',
26+
'waffle',
2627
]
2728

2829
MIDDLEWARE = [
@@ -33,6 +34,7 @@
3334
'django.contrib.auth.middleware.AuthenticationMiddleware',
3435
'django.contrib.messages.middleware.MessageMiddleware',
3536
'django.middleware.clickjacking.XFrameOptionsMiddleware',
37+
'waffle.middleware.WaffleMiddleware',
3638
]
3739

3840
ROOT_URLCONF = 'landing_page.urls'

landing_page/mainpage/templates/mainpage/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,14 @@ <h3 class="text-center d-none d-lg-block">онлайн курс</h3>
267267

268268
{% include 'mainpage/include/index_faq.html' %}
269269

270+
{% if should_show_chat %}
271+
<div
272+
style=" position: fixed; bottom: 30px !important; right: 130px !important; z-index: 10;"
273+
class="elfsight-app-7dcaa723-afe4-4ce3-9a9f-65841d5bd690"
274+
data-elfsight-app-lazy
275+
></div>
276+
{% endif %}
270277
{% include 'mainpage/include/index_footer.html' %}
271-
272278
</main>
273279

274280
{% include 'mainpage/include/index_register_popup.html' with enrollment=enrollment %}
@@ -291,5 +297,6 @@ <h3 class="text-center d-none d-lg-block">онлайн курс</h3>
291297
crossorigin="anonymous"
292298
referrerpolicy="no-referrer"
293299
></script>
300+
<script src="https://static.elfsight.com/platform/platform.js" data-use-service-core defer></script>
294301
</body>
295302
</html>

landing_page/mainpage/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from django.http import HttpRequest, HttpResponse
44
from django.shortcuts import render
5+
from waffle import switch_is_active
56

67
from .models import CourseReview, Curators, Enrollment, EnrollmentType, GraduateProjects
78

@@ -18,6 +19,7 @@ def index(request: HttpRequest) -> HttpResponse:
1819
'curators_list': Curators.objects.filter(is_visible=True),
1920
'today': date.today(),
2021
'reviews': CourseReview.objects.filter(review_for=EnrollmentType.BASE),
22+
'should_show_chat': switch_is_active('show_tg_chat_widget'),
2123
}
2224
return render(request, 'mainpage/index.html', context)
2325

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Django==4.2.4
22
Pillow==10.0.0
33
requests==2.31.0
44
django-memoize==2.3.1
5+
django-waffle==4.0.0

0 commit comments

Comments
 (0)