diff --git a/apps/course/models.py b/apps/course/models.py index e31e0270..42a1dd81 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -136,7 +136,7 @@ class Course(BaseModel, DeactivatedMixin): return self.get_absolute_url() def get_absolute_url(self): - return reverse_lazy('course', args=[self.id]) + return reverse_lazy('course', args=[self.slug or self.id]) @property def is_free(self): diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index fbfb2a5a..a5bfa123 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -7,7 +7,7 @@ data-course data-course-id={{ course.id }} {% if course.is_deferred_start and course.status == 2 %}data-future-course data-future-course-time={{ course.deferred_start_at.timestamp }}{% endif %} > - + {% thumbnail course.cover.image "300x200" crop="center" as im %} {% empty %} @@ -56,7 +56,7 @@
{{ course.price|floatformat:"-2" }}₽
{% endif %} -
{{ course.title }} + {{ course.title }}
{{ course.short_description | safe | linebreaks | truncatechars_html:300 }}
diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index dc5400f2..94fd1938 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -145,7 +145,7 @@
- Описание курса + Описание курса {% if request.user.is_authenticated %} {% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %}
- Описание курса + Описание курса {% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %}
Вы успешно приобрели курс!
- ПЕРЕЙТИ К КУРСУ + ПЕРЕЙТИ К КУРСУ
diff --git a/apps/payment/templates/payment/payment_success.html b/apps/payment/templates/payment/payment_success.html index 9d256634..fe3c6a15 100644 --- a/apps/payment/templates/payment/payment_success.html +++ b/apps/payment/templates/payment/payment_success.html @@ -11,7 +11,7 @@ {% if course %}
Вы успешно приобрели курс!
- ПЕРЕЙТИ К КУРСУ + ПЕРЕЙТИ К КУРСУ
{% endif %} {% if gift_certificate %} diff --git a/apps/school/models.py b/apps/school/models.py index 4eb71350..4ba85193 100644 --- a/apps/school/models.py +++ b/apps/school/models.py @@ -142,8 +142,12 @@ class LiveLesson(BaseModel, DeactivatedMixin): self.date = (datetime.combine(self.date, now().time()) + timedelta(days=1)).date() super().save(*args, **kwargs) + @property + def url(self): + return self.get_absolute_url() + def get_absolute_url(self): - return reverse_lazy('school:lesson-detail', args=[str(self.id)]) + return reverse_lazy('school:lesson-detail', args=[self.date.strftime('%d-%m-%y')]) def stream_index(self): return self.stream.split('/')[-1] diff --git a/apps/school/templates/blocks/open_lesson.html b/apps/school/templates/blocks/open_lesson.html index 46999c7f..1aefa579 100644 --- a/apps/school/templates/blocks/open_lesson.html +++ b/apps/school/templates/blocks/open_lesson.html @@ -1,4 +1,4 @@ смотреть урок diff --git a/apps/school/templates/school/livelessons_list.html b/apps/school/templates/school/livelessons_list.html index 237072b0..2f435dcc 100644 --- a/apps/school/templates/school/livelessons_list.html +++ b/apps/school/templates/school/livelessons_list.html @@ -11,7 +11,7 @@ {% for livelesson in livelesson_list %}
- + diff --git a/apps/school/templates/summer/open_lesson.html b/apps/school/templates/summer/open_lesson.html index abb8a9a2..793fb589 100644 --- a/apps/school/templates/summer/open_lesson.html +++ b/apps/school/templates/summer/open_lesson.html @@ -1,4 +1,4 @@ подробнее diff --git a/apps/school/urls.py b/apps/school/urls.py index 59973c6d..c36664f0 100644 --- a/apps/school/urls.py +++ b/apps/school/urls.py @@ -13,4 +13,5 @@ urlpatterns = [ path('lessons/create', LiveLessonEditView.as_view(), name='lessons-create'), path('lessons//edit', LiveLessonEditView.as_view(), name='lessons-edit'), path('lessons//', LiveLessonsDetailView.as_view(), name='lesson-detail'), + path('', LiveLessonsDetailView.as_view(), name='lesson-detail'), ] diff --git a/apps/school/views.py b/apps/school/views.py index b58869b5..9081acd6 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -61,8 +61,11 @@ class LiveLessonsDetailView(DetailView): model = LiveLesson template_name = 'school/livelesson_detail.html' - def get(self, request, pk=None): - self.object = self.get_object() + def get(self, request, pk=None, lesson_date=None): + if pk: + self.object = self.get_object() + if lesson_date: + self.object = LiveLesson.objects.get(date=datetime.strptime(lesson_date, '%d-%m-%y')) if request.user.is_authenticated: is_purchased = SchoolPayment.objects.filter( user=request.user, diff --git a/project/settings.py b/project/settings.py index 40ac56bb..7c7d41b8 100644 --- a/project/settings.py +++ b/project/settings.py @@ -176,6 +176,7 @@ STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder', ] +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') diff --git a/project/templates/blocks/lil_store_js.html b/project/templates/blocks/lil_store_js.html index 39770603..b2eeb14c 100644 --- a/project/templates/blocks/lil_store_js.html +++ b/project/templates/blocks/lil_store_js.html @@ -9,7 +9,7 @@ ADMIN_ROLE: 3, }, pusherKey: '{% setting "PUSHER_KEY" %}', - staticUrl: '{% static "" %}', + staticUrl: '{% get_static_prefix %}', accessToken: '{{ request.user.auth_token }}', isMobile: {{ request.user_agent.is_mobile|yesno:"true,false" }}, defaultUserPhoto: "{% static 'img/user_default.jpg' %}", diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index ada31a74..6e1b28a0 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -155,7 +155,7 @@
{% include 'templates/blocks/lil_store_js.html' %} {% block pre_app_js %}{% endblock pre_app_js %} - +