Merge branch 'master' of gitlab.com:lilcity/backend into course_old_price

remotes/origin/course_old_price
gzbender 7 years ago
commit 757deeb3f7
  1. 2
      apps/course/models.py
  2. 4
      apps/course/templates/course/_items.html
  3. 2
      apps/course/templates/course/course.html
  4. 2
      apps/course/templates/course/course_only_lessons.html
  5. 2
      apps/payment/templates/payment/course_payment_success.html
  6. 2
      apps/payment/templates/payment/payment_success.html
  7. 6
      apps/school/models.py
  8. 2
      apps/school/templates/blocks/open_lesson.html
  9. 2
      apps/school/templates/school/livelessons_list.html
  10. 2
      apps/school/templates/summer/open_lesson.html
  11. 1
      apps/school/urls.py
  12. 7
      apps/school/views.py
  13. 1
      project/settings.py
  14. 2
      project/templates/blocks/lil_store_js.html
  15. 2
      project/templates/lilcity/index.html

@ -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):

@ -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 %}
>
<a class="courses__preview" href="{% if course.status <= 1 %}{% url 'course_edit' course.id %}{% else %}{% url 'course' course.id %}?next={{ request.get_full_path }}{% endif %}">
<a class="courses__preview" href="{% if course.status <= 1 %}{% url 'course_edit' course.id %}{% else %}{{ course.url }}{% endif %}">
{% thumbnail course.cover.image "300x200" crop="center" as im %}
<img class="courses__pic" src="{{ im.url }}" width="{{ im.width }}" />
{% empty %}
@ -56,7 +56,7 @@
<div class="courses__price">{{ course.price|floatformat:"-2" }}₽</div>
{% endif %}
</div>
<a class="courses__title" href="{% url 'course' course.id %}?next={{ request.get_full_path }}">{{ course.title }}</a>
<a class="courses__title" href="{{ course.url }}">{{ course.title }}</a>
<div class="courses__content">{{ course.short_description | safe | linebreaks | truncatechars_html:300 }}
</div>
<div class="courses__user user">

@ -145,7 +145,7 @@
</div>
</div>
<div class="course__actions">
<a href="{% url 'course' course.id %}" class="course__action btn btn_lg{% if not only_lessons %} btn_stroke{% else %} btn_gray{% endif %}">Описание курса</a>
<a href="{{ course.url }}" class="course__action btn btn_lg{% if not only_lessons %} btn_stroke{% else %} btn_gray{% endif %}">Описание курса</a>
{% if request.user.is_authenticated %}
{% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %}
<a

@ -132,7 +132,7 @@
</div>
</div>
<div class="course__actions">
<a href="{% url 'course' course.id %}" class="course__action btn btn_lg{% if not only_lessons %} btn_stroke{% else %} btn_gray{% endif %}">Описание курса</a>
<a href="{{ course.url }}" class="course__action btn btn_lg{% if not only_lessons %} btn_stroke{% else %} btn_gray{% endif %}">Описание курса</a>
{% if course.author == request.user and request.user.role >= request.user.AUTHOR_ROLE %}
<a
href="{% url 'course-only-lessons' course.id %}"

@ -4,7 +4,7 @@
<div class="done">
<div class="done__title title">Вы успешно приобрели курс!</div>
<div class="done__foot">
<a class="done__btn btn btn_md btn_stroke" href="{% url 'course' course.id %}">ПЕРЕЙТИ К КУРСУ</a>
<a class="done__btn btn btn_md btn_stroke" href="{{ course.url }}">ПЕРЕЙТИ К КУРСУ</a>
</div>
</div>
</div>

@ -11,7 +11,7 @@
{% if course %}
<div class="done__title title">Вы успешно приобрели курс!</div>
<div class="done__foot">
<a class="done__btn btn btn_md btn_stroke" href="{% url 'course' course.id %}">ПЕРЕЙТИ К КУРСУ</a>
<a class="done__btn btn btn_md btn_stroke" href="{{ course.url }}">ПЕРЕЙТИ К КУРСУ</a>
</div>
{% endif %}
{% if gift_certificate %}

@ -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]

@ -1,4 +1,4 @@
<a
class="timing__btn btn btn_light"
href="{% url 'school:lesson-detail' live_lesson.id %}"
href="{{ live_lesson.url }}"
>смотреть урок</a>

@ -11,7 +11,7 @@
{% for livelesson in livelesson_list %}
<div class="lessons__item">
<div class="lessons__actions lessons__actions__no-hover">
<a target="_blank" class="lessons__action" href="{% url 'school:lesson-detail' livelesson.id %}">
<a target="_blank" class="lessons__action" href="{{ live_lesson.url }}">
<svg class="icon icon-eye">
<use xlink:href="{% static 'img/sprite.svg' %}#icon-eye"></use>
</svg>

@ -1,4 +1,4 @@
<a
class="timing__btn btn btn_light"
href="{% url 'school:lesson-detail' live_lesson.id %}"
href="{{ live_lesson.url }}"
>подробнее</a>

@ -13,4 +13,5 @@ urlpatterns = [
path('lessons/create', LiveLessonEditView.as_view(), name='lessons-create'),
path('lessons/<int:pk>/edit', LiveLessonEditView.as_view(), name='lessons-edit'),
path('lessons/<int:pk>/', LiveLessonsDetailView.as_view(), name='lesson-detail'),
path('<str:lesson_date>', LiveLessonsDetailView.as_view(), name='lesson-detail'),
]

@ -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,

@ -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')

@ -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' %}",

@ -155,7 +155,7 @@
</div>
{% include 'templates/blocks/lil_store_js.html' %}
{% block pre_app_js %}{% endblock pre_app_js %}
<script type="text/javascript" src="{% static "app.js" %}?2"></script>
<script type="text/javascript" src="{% static "app.js" %}"></script>
<script>
var schoolDiscount = parseFloat({{ config.SERVICE_DISCOUNT }});
var schoolAmountForDiscount = parseFloat({{ config.SERVICE_DISCOUNT_MIN_AMOUNT }});

Loading…
Cancel
Save