diff --git a/api/v1/serializers/user.py b/api/v1/serializers/user.py index 7f22b108..f73249ae 100644 --- a/api/v1/serializers/user.py +++ b/api/v1/serializers/user.py @@ -45,6 +45,7 @@ class UserSerializer(serializers.ModelSerializer): read_only_fields = ( 'id', + 'username', 'photo', 'date_joined', 'is_staff', @@ -54,6 +55,9 @@ class UserSerializer(serializers.ModelSerializer): ) def create(self, validated_data): + username = validated_data.get('username', None) + if not username: + validated_data['username'] = validated_data['email'] instance = super().create(validated_data) if not instance.password: password = User.objects.make_random_password() diff --git a/api/v1/views.py b/api/v1/views.py index b49869c1..6fbde9c6 100644 --- a/api/v1/views.py +++ b/api/v1/views.py @@ -419,13 +419,13 @@ class AuthorRequestViewSet(ExtendedModelViewSet): class PaymentViewSet(ExtendedModelViewSet): - queryset = Payment.objects.all() + queryset = Payment.objects.order_by('-created_at') serializer_class = PaymentSerializer permission_classes = (IsAdmin,) filter_fields = ('status',) ordering_fields = ( 'id', 'user__email', - 'user__firstname', 'user__lastname', + 'user__first_name', 'user__last_name', 'amount', 'created_at', ) - search_fields = ('user__email', 'user__firstname', 'user__lastname',) + search_fields = ('user__email', 'user__first_name', 'user__last_name',) diff --git a/apps/auth/templates/auth/password_reset_subject.txt b/apps/auth/templates/auth/password_reset_subject.txt index bca0a5e0..46155f81 100644 --- a/apps/auth/templates/auth/password_reset_subject.txt +++ b/apps/auth/templates/auth/password_reset_subject.txt @@ -1 +1 @@ -Password reset \ No newline at end of file +Восстановление пароля diff --git a/apps/auth/views.py b/apps/auth/views.py index 4365c0e3..4e173b1b 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -56,7 +56,7 @@ class LearnerRegistrationView(FormView): refferer = str(refferer[0]) + '://' + str(refferer[1]) token = verification_email_token.make_token(user) url = refferer + str(reverse_lazy('lilcity:verification-email', args=[token])) - send_email('Verification Email', email, "notification/email/verification_email.html", url=url, config=config) + send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config) return JsonResponse({"success": True}, status=201) diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 5319b366..ecb1b319 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -8,8 +8,8 @@ {% block twurl %}{{ request.build_absolute_uri }}{% endblock twurl %} {% block ogtitle %}{{ course.title }} - {{ block.super }}{% endblock ogtitle %} {% block ogurl %}{{ request.build_absolute_uri }}{% endblock ogurl %} -{% if course.cover %} -{% block ogimage %}{{ request.build_absolute_uri }}{{ course.cover.url }}{% endblock ogimage %} +{% if course.cover and course.cover.image %} +{% block ogimage %}http://{{request.META.HTTP_HOST}}{{ course.cover.image.url }}{% endblock ogimage %} {% endif %} {% block ogdescription %}{{ course.short_description }}{% endblock ogdescription %} diff --git a/apps/course/templates/course/inclusion/category_menu_items.html b/apps/course/templates/course/inclusion/category_menu_items.html index b09f7a8a..105b803b 100644 --- a/apps/course/templates/course/inclusion/category_menu_items.html +++ b/apps/course/templates/course/inclusion/category_menu_items.html @@ -1,5 +1,8 @@ {% for cat in category_items %} + +
Все курсы
+
{{ cat.title }}
-{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html index c708702c..b886dc4f 100644 --- a/apps/school/templates/school/livelesson_detail.html +++ b/apps/school/templates/school/livelesson_detail.html @@ -13,6 +13,7 @@ + Если видео не загрузилось обновите страницу {% else %} {% if livelesson.cover %} diff --git a/apps/user/models.py b/apps/user/models.py index 70d19f7c..fd94ab81 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -21,7 +21,7 @@ class UserManager(BaseUserManager): def _create_user(self, username, email, password, **extra_fields): if not username: - raise ValueError('The given username must be set') + username = email if not password: password = self.make_random_password() super().save(*args, **kwargs) diff --git a/apps/user/views.py b/apps/user/views.py index 1c0e77b6..bf2a6ebd 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -37,7 +37,7 @@ User = get_user_model() def resend_email_verify(request): token = verification_email_token.make_token(request.user) url = request.scheme + '://' + request.get_host() + str(reverse_lazy('lilcity:verification-email', args=[token])) - send_email('Verification Email', request.user.email, "notification/email/verification_email.html", url=url) + send_email('Вы успешно прошли регистрацию', request.user.email, "notification/email/verification_email.html", url=url) messages.info(request, 'Письмо подтверждения отправлено.') return redirect('user-edit-profile', request.user.id) diff --git a/project/settings.py b/project/settings.py index e72c3c78..24ee180e 100644 --- a/project/settings.py +++ b/project/settings.py @@ -84,6 +84,7 @@ TEMPLATES = [ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ 'project', + 'templates', ], 'OPTIONS': { 'context_processors': [ diff --git a/project/templates/blocks/footer.html b/project/templates/blocks/footer.html index 878ab421..8ccb6bee 100644 --- a/project/templates/blocks/footer.html +++ b/project/templates/blocks/footer.html @@ -11,7 +11,7 @@ diff --git a/project/templates/blocks/header.html b/project/templates/blocks/header.html index 71cfefe7..fe75a445 100644 --- a/project/templates/blocks/header.html +++ b/project/templates/blocks/header.html @@ -27,7 +27,7 @@ diff --git a/project/templates/blocks/share.html b/project/templates/blocks/share.html index 6c9abb2c..c895fe32 100644 --- a/project/templates/blocks/share.html +++ b/project/templates/blocks/share.html @@ -1,23 +1,24 @@ {% load static %} +
Поделиться {% if livelesson or lesson %}уроком{% else %}курсом{% endif %}
- - - -