diff --git a/apps/auth/views.py b/apps/auth/views.py index 6c3cd79b..9dccdbe9 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -48,7 +48,8 @@ class LearnerRegistrationView(FormView): # fixme: change email text # fixme: async send email token = verification_email_token.make_token(user) - send_email('Verification Email', email, "notification/email/verification_email.html", token=token) + url = self.request.scheme + '://' + self.request.get_host() + str(reverse_lazy('lilcity:verification-email', args=[token])) + send_email('Verification Email', email, "notification/email/verification_email.html", url=url) return JsonResponse({"success": True}, status=201) @@ -80,9 +81,8 @@ class VerificationEmailView(View): request.user, kwargs.get('token')) if is_valid_token: - lilcity_user_settings = request.user.lilcity_user_settings - lilcity_user_settings.is_verification_email = True - lilcity_user_settings.save() + request.user.is_email_proved = True + request.user.save() return JsonResponse({"success": True}) else: return JsonResponse({"success": False}, status=400) diff --git a/apps/course/fixtures/course.json b/apps/course/fixtures/course.json index 7daa5139..52f5bba3 100644 --- a/apps/course/fixtures/course.json +++ b/apps/course/fixtures/course.json @@ -6,8 +6,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "1500.00", "is_infinite": false, "deferred_start_at": null, "category": 2, @@ -16,7 +17,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:04:41.113Z", - "update_at": "2018-01-27T07:12:04.168Z" + "update_at": "2018-01-31T15:03:47.118Z", + "likes": [], + "materials": [] } }, { @@ -26,8 +29,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "1900.00", "is_infinite": false, "deferred_start_at": null, "category": 1, @@ -36,7 +40,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.437Z", - "update_at": "2018-01-27T07:11:55.373Z" + "update_at": "2018-01-31T15:03:47.115Z", + "likes": [], + "materials": [] } }, { @@ -46,8 +52,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "100.00", "is_infinite": false, "deferred_start_at": null, "category": 9, @@ -56,7 +63,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.442Z", - "update_at": "2018-01-27T07:11:43.838Z" + "update_at": "2018-01-31T15:03:47.112Z", + "likes": [], + "materials": [] } }, { @@ -66,8 +75,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "400.00", "is_infinite": false, "deferred_start_at": null, "category": 8, @@ -76,7 +86,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.445Z", - "update_at": "2018-01-27T07:11:35.342Z" + "update_at": "2018-01-31T15:03:47.108Z", + "likes": [], + "materials": [] } }, { @@ -86,8 +98,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "1800.00", "is_infinite": false, "deferred_start_at": null, "category": 7, @@ -96,7 +109,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.449Z", - "update_at": "2018-01-27T07:11:26.725Z" + "update_at": "2018-01-31T15:03:47.104Z", + "likes": [], + "materials": [] } }, { @@ -106,8 +121,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "100.00", "is_infinite": false, "deferred_start_at": null, "category": 6, @@ -116,7 +132,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.452Z", - "update_at": "2018-01-27T07:11:15.061Z" + "update_at": "2018-01-31T15:03:47.101Z", + "likes": [], + "materials": [] } }, { @@ -126,8 +144,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "1600.00", "is_infinite": false, "deferred_start_at": null, "category": 5, @@ -136,7 +155,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.455Z", - "update_at": "2018-01-27T07:11:03.583Z" + "update_at": "2018-01-31T15:03:47.097Z", + "likes": [], + "materials": [] } }, { @@ -146,8 +167,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "1900.00", "is_infinite": false, "deferred_start_at": null, "category": 4, @@ -156,7 +178,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.458Z", - "update_at": "2018-01-27T07:10:52.322Z" + "update_at": "2018-01-31T15:03:47.093Z", + "likes": [], + "materials": [] } }, { @@ -166,8 +190,9 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "200.00", "is_infinite": false, "deferred_start_at": null, "category": 3, @@ -176,7 +201,9 @@ "url": "https://gitlab.com/", "status": 0, "created_at": "2018-01-27T07:09:03.461Z", - "update_at": "2018-01-27T07:10:42.721Z" + "update_at": "2018-01-31T15:03:47.089Z", + "likes": [], + "materials": [] } }, { @@ -186,17 +213,24 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "800.00", "is_infinite": false, "deferred_start_at": null, "category": 2, "duration": 1, - "is_featured": false, + "is_featured": true, "url": "https://gitlab.com/", - "status": 0, + "status": 1, "created_at": "2018-01-27T07:09:03.464Z", - "update_at": "2018-01-27T07:10:33.374Z" + "update_at": "2018-01-31T15:03:47.086Z", + "likes": [], + "materials": [ + 1, + 2, + 3 + ] } }, { @@ -206,17 +240,24 @@ "author": 1, "title": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0443\u0440\u0441 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438", "short_description": "\u042d\u0442\u043e\u0442 \u043a\u0443\u0440\u0441 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0442\u044f\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u0435\u043b\u044b\u0439 \u0438 \u0445\u0430\u0440\u0438\u0437\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.", + "from_author": "", "cover": "courses/pic-1_sTaZawQ.jpg", - "price": "50.00", + "price": "100.00", "is_infinite": false, - "deferred_start_at": null, + "deferred_start_at": "2018-02-28T12:00:00Z", "category": 1, "duration": 1, "is_featured": false, "url": "https://gitlab.com/", - "status": 0, + "status": 1, "created_at": "2018-01-27T07:09:03.467Z", - "update_at": "2018-01-27T07:09:03.467Z" + "update_at": "2018-01-31T15:03:47.080Z", + "likes": [], + "materials": [ + 1, + 2, + 3 + ] } }, { @@ -281,5 +322,74 @@ "fields": { "title": "\u0436\u0438\u0432\u043e\u043f\u0438\u0441\u044c" } + }, + { + "model": "course.lesson", + "pk": 1, + "fields": { + "title": "1 \u0423\u0420\u041e\u041a", + "short_description": "\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u044e\u0436\u0435\u0442, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043a\u0443\u0440\u0441\u0435 \u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f \u0432\u0430\u0448\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u0421 \u044d\u0442\u0438\u043c \u0433\u0435\u0440\u043e\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u0430.", + "course": 11, + "cover": "lessons/kat-watercolor.jpg", + "created_at": "2018-01-31T15:06:14.830Z", + "update_at": "2018-01-31T15:06:14.830Z" + } + }, + { + "model": "course.lesson", + "pk": 2, + "fields": { + "title": "2 \u0423\u0420\u041e\u041a", + "short_description": "\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0433\u0435\u0440\u043e\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u041f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u00ab\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u044b\u00bb. \u0420\u0438\u0441\u0443\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 \u0441\u0432\u043e\u0435\u043c \u0441\u0442\u0438\u043b\u0435.\r\n\r\n\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0438\u0445 \u0432 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u0431\u0440\u043e\u0441\u043a\u0435.", + "course": 11, + "cover": "lessons/kat-watercolor_SA9juHa.jpg", + "created_at": "2018-01-31T15:06:46.772Z", + "update_at": "2018-01-31T15:06:46.772Z" + } + }, + { + "model": "course.lesson", + "pk": 3, + "fields": { + "title": "3 \u0423\u0420\u041e\u041a", + "short_description": "\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0436\u0438\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c 5 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u0440\u043e\u044f \u0438 \u0442\u043e\u0433\u043e \u0441\u044e\u0436\u0435\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0443\u0447\u0430\u0441\u0442\u0438\u0435, \u0440\u0438\u0441\u0443\u0435\u043c \u044d\u0441\u043a\u0438\u0437\u044b \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043f\u043e\u0437\u0430\u0445 \u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0438.\r\n\r\n\u0412\u044b\u0434\u0435\u043b\u044f\u0435\u043c 5 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u044d\u043c\u043e\u0446\u0438\u0439 \u0434\u043b\u044f \u0433\u0435\u0440\u043e\u044f, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041f\u043e \u044d\u043c\u043e\u0446\u0438\u044f\u043c \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u044b \u0438 \u0441\u0442\u0438\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u0445 \u0432 \u0441\u0432\u043e\u0435\u043c \u0441\u0442\u0438\u043b\u0435.", + "course": 11, + "cover": "lessons/kat-watercolor_QYFi9sq.jpg", + "created_at": "2018-01-31T15:07:08.979Z", + "update_at": "2018-01-31T15:07:08.979Z" + } + }, + { + "model": "course.material", + "pk": 1, + "fields": { + "title": "\u0411\u0443\u043c\u0430\u0433\u0430 \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c\u043d\u0430\u044f", + "cover": "materials/kat-watercolor.jpg", + "short_description": "\u0411\u0443\u043c\u0430\u0433\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c\u044e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c \u2014 \u043a\u0440\u0430\u0441\u043a\u0430 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u0430\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0444\u0430\u043a\u0442\u0443\u0440\u0430 \u0431\u0443\u043c\u0430\u0433\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043a\u0440\u0430\u0441\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f.", + "created_at": "2018-01-31T14:55:48.394Z", + "update_at": "2018-01-31T14:55:48.394Z" + } + }, + { + "model": "course.material", + "pk": 2, + "fields": { + "title": "\u041a\u0438\u0441\u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f", + "cover": "materials/shutterstock_125323070-700x861.jpg", + "short_description": "\u041a\u0438\u0441\u0442\u044c \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u043a\u0440\u0430\u0441\u043a\u0438 \u0438 \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u0438. \u041a\u0438\u0441\u0442\u0438 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0449\u0435\u0442\u0438\u043d\u044b \u0438 \u0445\u0432\u043e\u0441\u0442\u043e\u0432\u044b\u0445 \u0432\u043e\u043b\u043e\u0441\u043a\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0445.", + "created_at": "2018-01-31T14:57:37.751Z", + "update_at": "2018-01-31T14:57:37.751Z" + } + }, + { + "model": "course.material", + "pk": 3, + "fields": { + "title": "\u041a\u0440\u0430\u0441\u043a\u0438 \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c\u043d\u044b\u0435", + "cover": "materials/\u043a\u0440\u0430\u0441\u043a\u0438.jpeg", + "short_description": "\u0417\u0430\u0432\u043e\u0434 \u0445\u0443\u0434\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043a\u0440\u0430\u0441\u043e\u043a \u00ab\u041d\u0435\u0432\u0441\u043a\u0430\u044f \u043f\u0430\u043b\u0438\u0442\u0440\u0430\u00bb \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c 80 \u043b\u0435\u0442, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438 \u0432\u044b\u0441\u043e\u0447\u0430\u0439\u0448\u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u0443\u0440\u044b, \u043e\u0442\u043b\u0430\u0436\u0435\u043d\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0430\u043a\u0432\u0430\u0440\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u0440\u0430\u0441\u043a\u0438 \u0432\u0438\u0437\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u043e\u0439 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u0432 \u0420\u043e\u0441\u0441\u0438\u0438", + "created_at": "2018-01-31T14:58:46.209Z", + "update_at": "2018-01-31T14:58:46.209Z" + } } ] \ No newline at end of file diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html index 0ca9e1f5..03e9dfec 100644 --- a/apps/course/templates/course/_items.html +++ b/apps/course/templates/course/_items.html @@ -23,7 +23,7 @@ {{ course.category | upper }} {% if not course.is_free %} -
{{ course.price|floatformat:"-2" }}$
+
{{ course.price|floatformat:"-2" }}₽
{% endif %} {{ course.title }} diff --git a/apps/course/templates/course/course.html b/apps/course/templates/course/course.html index 57caf71e..8cf511d5 100644 --- a/apps/course/templates/course/course.html +++ b/apps/course/templates/course/course.html @@ -1,42 +1,62 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% load data_liked from data_liked %} - +{% load rupluralize from plural %} {% block title %}{{ course.title }} - {{ block.super }}{% endblock title %} {% block content %}
-
+ + +
+
{{ course.category.title | upper }}
{% data_liked user course as liked %} -
{{ course.title }}
{{ course.short_description }}
{% if course.author.photo %} -
+
+ +
{% else %} -
+
+ +
{% endif %}
{{ course.author.get_full_name }}
@@ -48,79 +68,149 @@
-
-
{{ course.duration }}
+
+ + + +
+
{{ course.duration | rupluralize:"день,дня,дней" }}
-
+
+ + + +
15 ноября
-
-
{{ course.price|floatformat:"-2" }}$
+
+ + + +
+
{{ course.price|floatformat:"-2" }}₽
-
-
{{ course.lessons.count }}
+
+ + + +
+
{{ course.lessons.count | rupluralize:"урок,урока,уроков" }}
-
+
+ + + +
12 видео
-
+
+ + +
+ + + {% if course.is_deferred_start %} +
+
Курс начнется:
+
{{ course.deferred_start_at_humanize }}
+
+ {% else %} + + + + {% endif %} +
- {% if course.from_author %} + {% if course.from_author %}
От автора
{% if course.author.photo %} -
+
+ +
{% else %} -
+
+ +
{% endif %}
Привет всем!
{{ course.from_author }} -
{{ course.author.get_full_name }}
+
+ {{ course.author.get_full_name }}
- {% endif %} +
+ {% endif %}
@@ -128,13 +218,17 @@
Материалы, которые понадобятся
- {% for material in course.materials.all %} + {% for material in course.materials.all %}
{% if material.cover %} -
+
+ +
{% else %} -
- {% endif %} +
+ +
+ {% endif %}
{{ material.title }}
{{ material.short_description }}
@@ -148,18 +242,42 @@
Галерея итогов обучения
-
-
-
-
-
-
-
-
-
-
-
-
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
@@ -168,7 +286,7 @@ @@ -186,9 +312,13 @@
Этот курс поможет детям узнать о том как из простых форм создавать веселый и харизматичных персонажей.
{% if course.author.photo %} -
+
+ +
{% else %} -
+
+ +
{% endif %}
{{ course.author.get_full_name }}
@@ -200,18 +330,32 @@
-
-
{{ course.duration }}
+
+ + + +
+
{{ course.duration | rupluralize:"день,дня,дней" }}
-
+
+ + + +
15 ноября
-
-
{{ course.price|floatformat:"-2" }}$
+
+ + + +
+
{{ course.price|floatformat:"-2" }}₽
-
+
+ +
@@ -221,24 +365,26 @@
-
+
+ +
{% if user.is_authenticated %} - -
-
- + +
+ +
+ {% else %} -
Только зарегистрированные пользователи могут оставлять комментарии.
+
Только зарегистрированные пользователи могут оставлять комментарии.
{% endif %}
- {% include "./blocks/comments.html" with object=course %} + {% include "./blocks/comments.html" with object=course %}
@@ -247,10 +393,29 @@
-{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/apps/course/templatetags/plural.py b/apps/course/templatetags/plural.py new file mode 100644 index 00000000..9ff90c4d --- /dev/null +++ b/apps/course/templatetags/plural.py @@ -0,0 +1,16 @@ +from django import template +from django.template.defaultfilters import stringfilter + +register = template.Library() + + +@register.filter(is_safe=False) +@stringfilter +def rupluralize(value, arg): + args = arg.split(',') + try: + value = str(0 if not value or int(value) <= 0 else value)[-1:] + return value + ' ' + args[0 if value == '1' else (1 if value in '234' else 2)] + except: + raise template.TemplateSyntaxError + return '' diff --git a/apps/course/views.py b/apps/course/views.py index 38d3f921..8f5c7d14 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -87,6 +87,55 @@ def coursecomment(request, course_id): }) +@login_required +@csrf_exempt +@require_http_methods(['POST']) +def lessoncomment(request, Lesson): + try: + lesson = Lesson.objects.get(id=lesson_id) + except Lesson.DoesNotExist: + return JsonResponse({ + 'success': False, + 'errors': ['Lesson with id f{lesson_id} not found'] + }, status=400) + else: + reply_to = request.POST.get('reply_id', 0) + comment = request.POST.get('comment', '') + if not comment: + return JsonResponse({ + 'success': False, + 'errors': ['Comment can not be empty'] + }, status=400) + + if not int(reply_to): + lessoncomment = LessonComment.objects.create( + author=request.user, + content=comment, + course=course, + ) + else: + try: + _lessoncomment = LessonComment.objects.get(id=reply_to) + except LessonComment.DoesNotExist: + return JsonResponse({ + 'success': False, + 'errors': ['CourseComment with id f{reply_to} not found'] + }, status=400) + else: + lessoncomment = LessonComment.objects.create( + author=request.user, + content=comment, + course=course, + parent=_lessoncomment, + ) + ctx = {'node': lessoncomment, 'user': request.user} + html = loader.render_to_string('course/blocks/comment.html', ctx) + return JsonResponse({ + 'success': True, + 'comment': html, + }) + + class CourseView(DetailView): model = Course context_object_name = 'course' diff --git a/apps/notification/templates/notification/email/_base.html b/apps/notification/templates/notification/email/_base.html index 92d6d367..b4ce1c89 100644 --- a/apps/notification/templates/notification/email/_base.html +++ b/apps/notification/templates/notification/email/_base.html @@ -61,7 +61,7 @@ - Отписаться от рассылки + {% comment %} Отписаться от рассылки {% endcomment %} diff --git a/apps/notification/templates/notification/email/verification_email.html b/apps/notification/templates/notification/email/verification_email.html index 0a3bbeff..9763f0c9 100644 --- a/apps/notification/templates/notification/email/verification_email.html +++ b/apps/notification/templates/notification/email/verification_email.html @@ -1,5 +1,10 @@ {% extends "notification/email/_base.html" %} {% block content %} - {{ token }} -{% endblock content %} \ No newline at end of file +

Спасибо за регистрацию! Для продолжения работы, подтвердите, пожалуйста, электронную почту.

+
+ Нажмите для подтверждения +

Или скопируйте ссылку ниже, и вставьте её в адресную строку браузера.

+

{{ url }}

+
+{% endblock content %} diff --git a/apps/user/fixtures/superuser.json b/apps/user/fixtures/superuser.json index f9fc5b21..385896cb 100644 --- a/apps/user/fixtures/superuser.json +++ b/apps/user/fixtures/superuser.json @@ -4,29 +4,30 @@ "pk": 1, "fields": { "password": "pbkdf2_sha256$100000$HoGxjmAQy4yo$3u+CrUiFtooddpg16OEUaSSjqUlwgFUBP1gt75hEoJs=", - "last_login": "2018-01-28T08:41:44.702Z", + "last_login": "2018-01-31T14:51:34Z", "is_superuser": true, "username": "admin@lil.city", - "first_name": "", - "last_name": "", + "first_name": "Lil", + "last_name": "City", "is_staff": true, "is_active": true, - "date_joined": "2018-01-28T08:41:19.690Z", + "date_joined": "2018-01-28T08:41:19Z", "email": "admin@lil.city", "role": 0, - "gender": "", + "gender": "n", "country": "", "city": "", - "about": "", - "instagram": "", - "facebook": "", - "twitter": "", - "pinterest": "", - "youtube": "", - "vkontakte": "", + "about": "\u0417\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430 \u041f\u0425\u0423 \u0438\u043c \u041a.\u0410.\u0421\u0430\u0432\u0438\u0446\u043a\u043e\u0433\u043e \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a \u0442\u0435\u0430\u0442\u0440\u0430 \u0438 \u043a\u0438\u043d\u043e. \u0420\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0441 \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u043c\u0438 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u043c\u0438 \u0438 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u044b\u043c\u0438 \u0438\u0437\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u043c\u0438. \u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0438 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u0432\u044b\u0441\u0442\u0430\u0432\u043e\u043a. \u041e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \"Lil City\".", + "instagram": null, + "facebook": null, + "twitter": null, + "pinterest": null, + "youtube": null, + "vkontakte": null, "fb_id": null, "fb_data": {}, "is_email_proved": false, + "photo": "", "groups": [], "user_permissions": [] } diff --git a/media/lessons/kat-watercolor.jpg b/media/lessons/kat-watercolor.jpg new file mode 100644 index 00000000..d426e7f5 Binary files /dev/null and b/media/lessons/kat-watercolor.jpg differ diff --git a/media/lessons/kat-watercolor_QYFi9sq.jpg b/media/lessons/kat-watercolor_QYFi9sq.jpg new file mode 100644 index 00000000..d426e7f5 Binary files /dev/null and b/media/lessons/kat-watercolor_QYFi9sq.jpg differ diff --git a/media/lessons/kat-watercolor_SA9juHa.jpg b/media/lessons/kat-watercolor_SA9juHa.jpg new file mode 100644 index 00000000..d426e7f5 Binary files /dev/null and b/media/lessons/kat-watercolor_SA9juHa.jpg differ diff --git a/media/materials/kat-watercolor.jpg b/media/materials/kat-watercolor.jpg new file mode 100644 index 00000000..d426e7f5 Binary files /dev/null and b/media/materials/kat-watercolor.jpg differ diff --git a/media/materials/shutterstock_125323070-700x861.jpg b/media/materials/shutterstock_125323070-700x861.jpg new file mode 100644 index 00000000..15d790e4 Binary files /dev/null and b/media/materials/shutterstock_125323070-700x861.jpg differ diff --git a/media/materials/краски.jpeg b/media/materials/краски.jpeg new file mode 100644 index 00000000..c0d34541 Binary files /dev/null and b/media/materials/краски.jpeg differ diff --git a/project/settings.py b/project/settings.py index 41d842cc..f55487d1 100644 --- a/project/settings.py +++ b/project/settings.py @@ -127,7 +127,7 @@ AUTH_USER_MODEL = 'user.User' # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'ru-RU' TIME_ZONE = 'UTC' diff --git a/project/urls.py b/project/urls.py index 701135a6..30854945 100644 --- a/project/urls.py +++ b/project/urls.py @@ -21,6 +21,7 @@ from django.conf import settings from apps.course.views import ( CoursesView, likes, coursecomment, CourseView, LessonView, SearchView, + lessoncomment, ) from apps.user.views import UserView @@ -32,6 +33,7 @@ urlpatterns = [ path('course//like', likes, name='likes'), path('course//comment', coursecomment, name='coursecomment'), path('lesson//', LessonView.as_view(), name='lesson'), + path('lesson//comment', lessoncomment, name='lessoncomment'), path('search/', SearchView.as_view(), name='search'), path('user//', UserView.as_view(), name='user'), path('', TemplateView.as_view(template_name="templates/lilcity/main.html"), name='index'),