From 53a313a36d5f2ed09e4e82f08436c21ae25cd22d Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 18 Dec 2018 04:50:09 +0300 Subject: [PATCH 1/8] =?UTF-8?q?LIL-712=20=D0=A4=D0=BE=D1=80=D0=BC=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D1=80=D0=B0?= =?UTF-8?q?=D1=81=D0=B8=D0=B2=D1=8B=D1=85=20=D1=81=D1=81=D1=8B=D0=BB=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=B2=20=D1=83=D1=80=D0=BE=D0=BA=D0=B0=D1=85=20=D0=B8?= =?UTF-8?q?=20=D1=88=D0=BA=D0=BE=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/course/models.py | 2 +- apps/course/templates/course/_items.html | 4 ++-- apps/course/templates/course/course.html | 2 +- apps/course/templates/course/course_only_lessons.html | 2 +- apps/payment/templates/payment/course_payment_success.html | 2 +- apps/payment/templates/payment/payment_success.html | 2 +- apps/school/models.py | 6 +++++- apps/school/templates/blocks/open_lesson.html | 2 +- apps/school/templates/school/livelessons_list.html | 2 +- apps/school/templates/summer/open_lesson.html | 2 +- apps/school/urls.py | 1 + apps/school/views.py | 7 +++++-- 12 files changed, 21 insertions(+), 13 deletions(-) diff --git a/apps/course/models.py b/apps/course/models.py index 6272a318..63de75ec 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -132,7 +132,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 ff72a87d..75ef1cd6 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 %} @@ -53,7 +53,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 97f11f84..f64352fb 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -142,7 +142,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, From 042490c99efd4452c8ba4342bd99b0504dd20ec7 Mon Sep 17 00:00:00 2001 From: gzbender Date: Mon, 24 Dec 2018 00:44:56 +0300 Subject: [PATCH 2/8] =?UTF-8?q?LIL-724=20=D0=A0=D0=B5=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=20=D1=81=20=D0=BA=D0=B5=D1=88=D0=BE=D0=BC=20=D1=81=D0=BA=D1=80?= =?UTF-8?q?=D0=B8=D0=BF=D1=82=D0=BE=D0=B2=20=D0=B8=20=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/settings.py | 1 + project/templates/blocks/lil_store_js.html | 2 +- project/templates/lilcity/index.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) 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 %} - +