Merge branch 'hotfix/lil-609' into 'master'

LIL-609 Некорректное время в комментария

See merge request lilcity/backend!87
remotes/origin/feature/lil-592
cfwme 8 years ago
commit 84b4850702
  1. 7
      apps/course/models.py
  2. 3
      apps/payment/models.py
  3. 7
      apps/payment/views.py
  4. 2
      apps/school/templates/blocks/open_lesson.html
  5. 2
      apps/user/views.py

@ -7,6 +7,7 @@ from django.utils.text import slugify
from django.utils.timezone import now from django.utils.timezone import now
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.conf import settings
from polymorphic_tree.models import PolymorphicMPTTModel, PolymorphicTreeForeignKey from polymorphic_tree.models import PolymorphicMPTTModel, PolymorphicTreeForeignKey
from project.mixins import BaseModel, DeactivatedMixin from project.mixins import BaseModel, DeactivatedMixin
@ -129,11 +130,11 @@ class Course(BaseModel, DeactivatedMixin):
@property @property
def deferred_start_at_humanize(self): def deferred_start_at_humanize(self):
return arrow.get(self.deferred_start_at).humanize(locale='ru') return arrow.get(self.deferred_start_at, settings.TIME_ZONE).humanize(locale='ru')
@property @property
def created_at_humanize(self): def created_at_humanize(self):
return arrow.get(self.created_at).humanize(locale='ru') return arrow.get(self.created_at, settings.TIME_ZONE).humanize(locale='ru')
@property @property
def is_deferred_start(self): def is_deferred_start(self):
@ -234,7 +235,7 @@ class Comment(PolymorphicMPTTModel, DeactivatedMixin):
@property @property
def created_at_humanize(self): def created_at_humanize(self):
return arrow.get(self.created_at).humanize(locale='ru') return arrow.get(self.created_at, settings.TIME_ZONE).humanize(locale='ru')
def __str__(self): def __str__(self):
return self.content return self.content

@ -9,6 +9,7 @@ from django.contrib.auth import get_user_model
from django.contrib.postgres.fields import ArrayField, JSONField from django.contrib.postgres.fields import ArrayField, JSONField
from django.core.validators import RegexValidator from django.core.validators import RegexValidator
from django.utils.timezone import now from django.utils.timezone import now
from django.conf import settings
from project.utils import weekday_in_date_range from project.utils import weekday_in_date_range
@ -198,4 +199,4 @@ class SchoolPayment(Payment):
@property @property
def date_end_humanize(self): def date_end_humanize(self):
return arrow.get(self.date_end).humanize(locale='ru') return arrow.get(self.date_end, settings.TIME_ZONE).humanize(locale='ru')

@ -17,6 +17,7 @@ from django.views.decorators.csrf import csrf_exempt
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.timezone import now from django.utils.timezone import now
from django.conf import settings
from paymentwall import Pingback, Product, Widget from paymentwall import Pingback, Product, Widget
@ -219,14 +220,14 @@ class PaymentwallCallbackView(View):
date_start = self.add_months(sourcedate=now().replace(hour=0, minute=0, day=1), months=1) date_start = self.add_months(sourcedate=now().replace(hour=0, minute=0, day=1), months=1)
date_end = school_payment.date_end date_end = school_payment.date_end
else: else:
date_start = arrow.get(school_payment.date_end).shift(days=1).datetime date_start = arrow.get(school_payment.date_end, settings.TIME_ZONE).shift(days=1).datetime
date_end = arrow.get(date_start).shift(months=1).datetime date_end = arrow.get(date_start, settings.TIME_ZONE).shift(months=1).datetime
else: else:
#month = 0 if now().day >= 1 and now().day <= 10 else 1 #month = 0 if now().day >= 1 and now().day <= 10 else 1
# Логика июльского лагеря: до конца июля приобретаем только на текущий месяц # Логика июльского лагеря: до конца июля приобретаем только на текущий месяц
month = 0 month = 0
date_start = self.add_months(sourcedate=now().replace(hour=0, minute=0, day=1), months=month) date_start = self.add_months(sourcedate=now().replace(hour=0, minute=0, day=1), months=month)
date_end = arrow.get(date_start).shift(months=1, minutes=-1).datetime date_end = arrow.get(date_start, settings.TIME_ZONE).shift(months=1, minutes=-1).datetime
payment.date_start = date_start payment.date_start = date_start
payment.date_end = date_end payment.date_end = date_end
if product_type_name == 'course': if product_type_name == 'course':

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

@ -1,5 +1,3 @@
import arrow
from io import BytesIO from io import BytesIO
from PIL import Image from PIL import Image
from uuid import uuid4 from uuid import uuid4

Loading…
Cancel
Save