From 552c640be72a5626a0c841ee66583db33e82b1d6 Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Fri, 21 Oct 2022 08:07:14 +0100 Subject: [PATCH 1/7] merge migration --- blog/migrations/0014_merge_20221021_0706.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 blog/migrations/0014_merge_20221021_0706.py diff --git a/blog/migrations/0014_merge_20221021_0706.py b/blog/migrations/0014_merge_20221021_0706.py new file mode 100644 index 0000000..30c1b56 --- /dev/null +++ b/blog/migrations/0014_merge_20221021_0706.py @@ -0,0 +1,13 @@ +# Generated by Django 4.1.2 on 2022-10-21 07:06 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("blog", "0009_alter_blog_options_alter_category_options_and_more"), + ("blog", "0013_alter_blog_image"), + ] + + operations = [] From 6c6f78f76875e47e7ecaca455785419bb887e40d Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Fri, 21 Oct 2022 08:33:49 +0100 Subject: [PATCH 2/7] added course to db admin and fixed minor errors. --- course/models.py | 3 +++ course/signals.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/course/models.py b/course/models.py index 7be81dc..2ba0788 100644 --- a/course/models.py +++ b/course/models.py @@ -22,6 +22,9 @@ class CourseCategory(models.Model): is_top = models.BooleanField(default=False) courses = models.ManyToManyField("course.Course", blank=True) + class Meta: + verbose_name_plural = 'Course categories' + def __str__(self): return self.title diff --git a/course/signals.py b/course/signals.py index 9b825e4..aea3fcf 100644 --- a/course/signals.py +++ b/course/signals.py @@ -12,7 +12,7 @@ def create_new_course_classroom(sender, instance, **kwargs): if instance.is_new is True: ClassRoom.objects.create( - tutor=instance.tutors, course=Course.objects.get(slug=instance.slug) + tutor=instance.tutor, course=Course.objects.get(slug=instance.slug) ) instance.is_new = False instance.save() From 85fb0ce13005d044196973796bc2ce2fe95947bc Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Fri, 21 Oct 2022 12:46:57 +0100 Subject: [PATCH 3/7] linked enroll button to course-detail and fixed errors. --- config/urls.py | 3 + course/models.py | 9 +- course/views.py | 2 +- .../templates/course/course-details.html | 1182 +++++++++++++++++ equestlms/templates/pages/home.html | 830 ++++++------ 5 files changed, 1649 insertions(+), 377 deletions(-) create mode 100644 equestlms/templates/course/course-details.html diff --git a/config/urls.py b/config/urls.py index 9e21eff..9750138 100644 --- a/config/urls.py +++ b/config/urls.py @@ -16,6 +16,9 @@ path("accounts/", include("allauth.urls")), # Blog path("blog/", include("blog.urls", namespace="blog")), + # Course + path("course/", include("course.urls", namespace="course")), + # vVideos path("videos/", include("videos.urls", namespace="videos")), # Tutor path("tutor/", include("tutor.urls", namespace="tutor")), diff --git a/course/models.py b/course/models.py index 2ba0788..3f2d95d 100644 --- a/course/models.py +++ b/course/models.py @@ -29,7 +29,7 @@ def __str__(self): return self.title def get_absolute_url(self): - return reverse("home:courses", kwargs={"slug": self.title}) + return reverse("home:course", kwargs={"slug": self.title}) def get_all_courses(self): courses_in_category = Course.objects.filter(category=self.title) @@ -43,9 +43,7 @@ class Course(TimeBasedModel): """ title = models.CharField(max_length=125, help_text="Title of the course") - category = models.ForeignKey( - CourseCategory, on_delete=models.CASCADE, default=1 - ) # Remove thhe default in develop branch + category = models.ForeignKey(CourseCategory, on_delete=models.CASCADE) # Remove thhe default in develop branch slug = models.SlugField(max_length=125, blank=True, null=True) overview = RichTextField() cover_image = models.ImageField(upload_to="./courses_cover_images/") @@ -71,6 +69,7 @@ def __str__(self) -> str: def save(self, *args, **kwargs): uuid_start = str(uuid.uuid1()).split("-", 1)[0] + print(uuid_start) if not self.pk: self.slug = slugify(self.title) + "-" + uuid_start @@ -81,7 +80,7 @@ def get_absolute_url(self): @property def tutor_courses_count(self): - return Course.objects.filter(tutors=self.tutors).count() + return Course.objects.filter(tutors=self.tutor).count() @property def student_courses_count(self): diff --git a/course/views.py b/course/views.py index 100f9a1..4753034 100644 --- a/course/views.py +++ b/course/views.py @@ -16,5 +16,5 @@ def get_queryset(self): class CourseDetailView(DetailView): model = Course - template_name = "course/course_detail.html" + template_name = "course/course-details.html" context_object_name = "course" diff --git a/equestlms/templates/course/course-details.html b/equestlms/templates/course/course-details.html new file mode 100644 index 0000000..291c92b --- /dev/null +++ b/equestlms/templates/course/course-details.html @@ -0,0 +1,1182 @@ +{% extends "base.html" %} +{% load static %} +{% block body %} + + +
+ + +
+
+ +
+
+ + + + + + + +
+
+ +
+ + +
+
+
+
+
+

{{ course.title }}

+ {{course.overview | safe}} +
+
+
+ + img + +
+
+
Nicole Brown +
+

UX/UI Designer

+
+
+ + + + + + 4.5 + (15) +
+
+ WEB DEVELPMENT +
+
+
+ +

12+ Lesson

+
+
+ +

9hr 30min

+
+
+ +

32 students enrolled

+
+
+
+ +
+ +
+ +
+
+
+
+
+ + +
+ + +
+
+
Overview
+
Course Description
+

Lorem Ipsum is simply dummy text of the printing and + typesetting industry. Lorem Ipsum has been the industry's + standard dummy text ever since the 1500s, when an unknown + printer took a galley of type and scrambled it to make a type + specimen book. It has survived not only five centuries, but also + the leap into electronic typesetting, remaining essentially + unchanged.

+

It was popularised in the 1960s with the release of Letraset + sheets containing Lorem Ipsum passages, and more recently with + desktop publishing software like Aldus PageMaker including + versions of Lorem Ipsum.

+ +
What you'll learn
+
+
+
    +
  • Become a UX designer.
  • +
  • You will be able to add UX designer to your CV
  • +
  • Become a UI designer.
  • +
  • Build & test a full website design.
  • +
  • Build & test a full mobile app.
  • +
+
+
+
    +
  • Learn to design websites & mobile phone apps.
  • +
  • You'll learn how to choose colors.
  • +
  • Prototype your designs with interactions.
  • +
  • Export production ready assets.
  • +
  • All the techniques used by UX professionals
  • +
+
+
+
Requirements
+
    +
  • You will need a copy of Adobe XD 2019 or above. A free trial + can be downloaded from Adobe.
  • +
  • No previous design experience is needed.
  • +
  • No previous Adobe XD skills are needed.
  • +
+
+
+ + + +
+
+
+
+
Course Content
+
+
+
92 Lectures 10:56:11
+
+
+
+
+ +
+
+
    +
  • +

    Lecture1.1 Introduction to the User + Experience Course

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.2 Exercise: Your first design + challenge

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.5 How to use text layers + effectively

    +
    + Preview + 02:53 +
    +
  • +
+
+
+
+
+ +
+
+
    +
  • +

    Lecture1.1 Introduction to the User + Experience Course

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.2 Exercise: Your first design + challenge

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.5 How to use text layers + effectively

    +
    + Preview + 02:53 +
    +
  • +
+
+
+
+
+ +
+
+
    +
  • +

    Lecture1.1 Introduction to the User + Experience Course

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.2 Exercise: Your first design + challenge

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture1.5 How to use text layers + effectively

    +
    + Preview + 02:53 +
    +
  • +
+
+
+
+
+ +
+
+
    +
  • +

    Lecture4.1 Introduction to the User + Experience Course

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture4.2 Exercise: Your first design + challenge

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture4.3 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture4.4 How to solve the previous + exercise

    +
    + Preview + 02:53 +
    +
  • +
  • +

    Lecture4.5 How to use text layers + effectively

    +
    + Preview + 02:53 +
    +
  • +
+
+
+
+
+ + + +
+
+
About the instructor
+
+
+
+ + img + +
+
+
Nicole Brown
+

UX/UI Designer

+
+
+
+ + + + + + 4.5 Instructor + Rating +
+
+
+
+ +

5 Courses

+
+
+ +

12+ Lesson

+
+
+ +

9hr 30min

+
+
+ +

270,866 students enrolled

+
+
+

UI/UX Designer, with 7+ Years Experience. Guarantee of High + Quality Work.

+

Skills: Web Design, UI Design, UX/UI Design, Mobile Design, + User Interface Design, Sketch, Photoshop, GUI, Html, Css, Grid + Systems, Typography, Minimal, Template, English, Bootstrap, + Responsive Web Design, Pixel Perfect, Graphic Design, Corporate, + Creative, Flat, Luxury and much more.

+ +

Available for:

+
    +
  • 1. Full Time Office Work
  • +
  • 2. Remote Work
  • +
  • 3. Freelance
  • +
  • 4. Contract
  • +
  • 5. Worldwide
  • +
+
+
+ + + +
+
+
Reviews
+
+
+
+ + img + +
+
+
Nicole Brown
+

UX/UI Designer

+
+
+
+ + + + + + 4.5 Instructor + Rating +
+
+

“ This is the second Photoshop course I have + completed with Cristian. Worth every penny and recommend it + highly. To get the most out of this course, its best to to take + the Beginner to Advanced course first. The sound and video + quality is of a good standard. Thank you Cristian. “

+ + Reply +
+
+ + + +
+
+
Post A comment
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +
+ + +
+
+
+
+
+

$200

+

$99.00 50% off

+
+
+ +
+ Share +
+ +
+ Buy Now +
+
+
+
+
+
+ + + +
+
+
+

Includes

+ +
+
    +
  • 11 hours on-demand video
  • +
  • 69 downloadable resources
  • +
  • Full lifetime access
  • +
  • Access on mobile and TV
  • +
  • Assignments
  • +
  • Certificate of Completion
  • +
+
+
+ + + +
+
+
+

Includes

+ +
+
    +
  • Enrolled: 32 students
  • +
  • Duration: 20 hours
  • +
  • Chapters: 15
  • +
  • Video: 12 hours
  • +
  • Level: Beginner
  • +
+
+
+ + + +
+
+
+
+ + + + +
+ + + + + + + + + + + +{% endblock body %} diff --git a/equestlms/templates/pages/home.html b/equestlms/templates/pages/home.html index b9f9db7..38bc1d4 100644 --- a/equestlms/templates/pages/home.html +++ b/equestlms/templates/pages/home.html @@ -1,427 +1,515 @@ {% extends "base.html" %} {% load static %} {% block body %} - -
-
-
-
-
-
-
The Leader in Online Learning
-

Engaging & Accessible Online Courses For All

-

Own your future learning new skills online

-
- -
-

Trusted by over 15K Users
worldwide since 2022

-
-
-

1000+

-
-
-

4.4

- - - - - -
-
+ +
+
+
+
+
+
+
The Leader in Online Learning
+

Engaging & Accessible Online Courses For All

+

Own your future learning new skills online

+
+ -
-
- + +
+
+

Trusted by over 15K Users
worldwide since 2022

+
+
+

1000+

+
+
+

4.4

+ + + + +
-
- -
-
-
-
-
-
-
-
-
- -
-
-

10K

-

Online Courses

-
-
-
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- -
-
-

200+

-

Expert Tutors

-
-
-
+
+

10K

+

Online Courses

-
-
-
-
-
- -
-
-

6K+

-

Ceritified Courses

-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- -
-
-

60K +

-

Online Students

-
-
-
+
+

200+

+

Expert Tutors

-
- - - -
-
-
-
- Favourite Course -

Top Category

-
-
- All Categories +
+
+
+
+
+ +
+
+

6K+

+

Ceritified Courses

+
+
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. Suspendisse imperdiet.

-
-
- +
+
+
+
+ - -
-
-
-
- What’s New -

Featured Courses

+ +
+
+
+
+ Favourite Course +

Top Category

+
+ +
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eget aenean + accumsan bibendum gravida maecenas augue elementum et neque. Suspendisse + imperdiet.

+
+
- +
+ {% empty %} - -
-
-
-
- What’s New -

TRENDING COURSES

-
- -
-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. Suspendisse imperdiet.

-
-
+ + + +
+
+
+
+ What’s New +

Featured Courses

+
+ +
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. + Suspendisse imperdiet.

+
+
+ + {% for course in featured %} +
+
+
+
+
+ + + +
+

₦{{ course.price }}

-
-
-
- -
-

{{ course.tutor }}

-

Tutor

-
-
-
- +
+
+
+
+ +
+

{{ course.tutor }} +

+

Tutor

-

{{ course.title }}

-
-
- -

13+ Lesson

-
-
- -

{{ course.hours_per_class }} Hours/Class

-
+
+
-
- - - - - - 4.0 (15) +
+

{{ course.title }}

+
+
+ +

12+ Lesson

+
+
+ +

{{ course.hours_per_class }} Hours/Class

- {% if user.is_authenticated and user.is_superuser %} - - {% elif user.is_authenticated %} - - {% else %} -
- Sign Up -
- {% endif %}
+
+ + + + + + 4.0 + (15) +
+ {% if user.is_authenticated and user.is_superuser %} + + + {% elif user.is_authenticated %} + + {% else %} +
+ Sign Up +
+ {% endif %}
- {% empty %} - {% if user.is_superuser %} -

No Featured Courses Yet!

- Add them now -
- {% endif %} - {% endfor %}
+
+
+ {% empty %} +
+ {% if user.is_superuser %} +

No Featured Courses Yet!

+ Add them now +
+ {% endif %} + {% endfor %} +
+
+
+ - -
-
-
-

Featured Instructor

-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. Suspendisse imperdiet.

+ +
+
+
+
+ What’s New +

TRENDING COURSES

+
+ +
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. + Suspendisse imperdiet.

+
+
- +
+ {% empty %} + {% if user.is_superuser %} +

No Featured Courses Yet!

+ Add them now +
+ {% endif %} + {% endfor %} +
- -
-
-
-
-

Latest Blogs

-
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Eget aenean accumsan bibendum gravida maecenas augue elementum et neque. Suspendisse imperdiet.

-
-
+ +
+
+
+

Featured Instructor

+
+

Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Eget aenean accumsan bibendum gravida maecenas augue elementum + et neque. Suspendisse imperdiet.

+
+
+
+ + - {% for blog in blogs %} -
-
- - - -
-
-
{{ blog.title }}
-

Marketing

-
- - {{ blog.created_at | timesince }} ago -
-
- {% endfor %} -
+
+
+ + + +
+
+
+
+

Latest Blogs

+
+

Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Eget aenean accumsan bibendum gravida maecenas augue elementum + et neque. Suspendisse imperdiet.

+
+
+
+
- + {% endfor %} +
+
+
+
+ {% endblock body %} From 9ce418bedcbcaae9cf33fa883e146b0befb30f9d Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Fri, 21 Oct 2022 14:44:50 +0100 Subject: [PATCH 4/7] updated course-detail template --- course/models.py | 2 +- course/views.py | 1 - .../templates/course/course-details.html | 60 +++++++------------ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/course/models.py b/course/models.py index 3f2d95d..769e257 100644 --- a/course/models.py +++ b/course/models.py @@ -80,7 +80,7 @@ def get_absolute_url(self): @property def tutor_courses_count(self): - return Course.objects.filter(tutors=self.tutor).count() + return Course.objects.filter(tutor=self.tutor).count() @property def student_courses_count(self): diff --git a/course/views.py b/course/views.py index 4753034..ad8d1ca 100644 --- a/course/views.py +++ b/course/views.py @@ -2,7 +2,6 @@ from course.models import Course - class AvailableCourseListView(ListView): model = Course template_name = "course/available_course.html" diff --git a/equestlms/templates/course/course-details.html b/equestlms/templates/course/course-details.html index 291c92b..26e4bc9 100644 --- a/equestlms/templates/course/course-details.html +++ b/equestlms/templates/course/course-details.html @@ -501,8 +501,9 @@
Rolands R
aria-current="page">Courses + + aria-current="page">{{ course.title }} @@ -536,9 +537,11 @@

{{ course.title }}

-
Nicole Brown +
+ {{ course.tutor}}
-

UX/UI Designer

+

{{ course.tutor.bio }}

@@ -551,7 +554,7 @@
Nicole Brown (15)
- WEB DEVELPMENT + {{course.category}}
@@ -579,7 +582,7 @@
Nicole Brown
@@ -595,18 +598,7 @@
Nicole Brown
Overview
Course Description
-

Lorem Ipsum is simply dummy text of the printing and - typesetting industry. Lorem Ipsum has been the industry's - standard dummy text ever since the 1500s, when an unknown - printer took a galley of type and scrambled it to make a type - specimen book. It has survived not only five centuries, but also - the leap into electronic typesetting, remaining essentially - unchanged.

-

It was popularised in the 1960s with the release of Letraset - sheets containing Lorem Ipsum passages, and more recently with - desktop publishing software like Aldus PageMaker including - versions of Lorem Ipsum.

- + {{course.overview|safe}}
What you'll learn
@@ -658,8 +650,7 @@
aria-expanded="false">In which areas do you operate?
+ class="card-collapse collapse">
  • aria-expanded="false">The Brief

+ class="card-collapse collapse">
  • aria-expanded="false">Wireframing Low Fidelity

    + class="card-collapse collapse">
    • aria-expanded="false">Type, Color & Icon Introduction

      + class="card-collapse collapse">
      • About the instructor

      -
      Nicole Brown
      -

      UX/UI Designer

      +
      {{course.tutor}} +
      +

      {{course.tutor.bio}}

    @@ -942,7 +931,7 @@
    Nicole Brown
    -

    5 Courses

    +

    {{course.tutor_courses_count}} Courses

    Nicole Brown

    270,866 students enrolled

    -

    UI/UX Designer, with 7+ Years Experience. Guarantee of High - Quality Work.

    -

    Skills: Web Design, UI Design, UX/UI Design, Mobile Design, - User Interface Design, Sketch, Photoshop, GUI, Html, Css, Grid - Systems, Typography, Minimal, Template, English, Bootstrap, - Responsive Web Design, Pixel Perfect, Graphic Design, Corporate, - Creative, Flat, Luxury and much more.

    +

    {{course.tutor.bio}}

    +

    {{course.tutor.about}}

    Available for:

      @@ -994,7 +978,8 @@
      Reviews
-
Nicole Brown
+
John Doe +

UX/UI Designer

@@ -1070,7 +1055,8 @@
Post A comment
-

$200

+

${{course.price | floatformat:2}} +

$99.00 50% off

From 8af1edbea35b6adc0a26c6ed6725d92599e1c74c Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Sun, 23 Oct 2022 07:10:19 +0100 Subject: [PATCH 5/7] Added mailing admin and displaying message to user feature on purchase. --- course/urls.py | 5 +++ course/views.py | 34 ++++++++++++++++- .../templates/course/course-details.html | 37 ++++++++++++++----- 3 files changed, 66 insertions(+), 10 deletions(-) diff --git a/course/urls.py b/course/urls.py index f63f60c..eca89af 100644 --- a/course/urls.py +++ b/course/urls.py @@ -14,4 +14,9 @@ view=course_view.CourseDetailView.as_view(), name="course-detail", ), + path( + "handle-purchase//", + view=course_view.HandlePurchaseView.as_view(), + name="handle-purchase", + ), ] diff --git a/course/views.py b/course/views.py index ad8d1ca..d58436f 100644 --- a/course/views.py +++ b/course/views.py @@ -1,6 +1,12 @@ +from django.shortcuts import redirect from django.views.generic import DetailView, ListView +from django.views import View +from .models import Course +from django.core.mail import send_mail +from django.contrib.auth import get_user_model +from django.contrib import messages +User = get_user_model() -from course.models import Course class AvailableCourseListView(ListView): model = Course @@ -17,3 +23,29 @@ class CourseDetailView(DetailView): model = Course template_name = "course/course-details.html" context_object_name = "course" + + +class HandlePurchaseView(View): + """ + Sends user details to admin admin and displays purchase status to user + """ + + def get(self, request, pk): + course = Course.objects.get(pk=pk) + if request.user.is_authenticated: + user = User.objects.get(pk=request.user.pk) + # Email admin + admin_email_details = { + 'subject': 'COURSE PURCHASE NOTIFICATION', + 'message': f'A user with name {user} made a purchase request. \n User details are as follows: \n Email: {user.email}', # type: ignore + 'recipient_list': ['solomonuche42@gmail.com'], + 'from_email': 'equestlms@equestlms.com' + + } + send_mail(subject=admin_email_details['subject'], message=admin_email_details["message"], + from_email=admin_email_details['from_email'], recipient_list=admin_email_details['recipient_list']) # type: ignore + # display message to user + messages.add_message(request, messages.INFO, + 'Thank you for learning with Equest, your purchase request has been sent.') + + return redirect(course) diff --git a/equestlms/templates/course/course-details.html b/equestlms/templates/course/course-details.html index 26e4bc9..aab1df0 100644 --- a/equestlms/templates/course/course-details.html +++ b/equestlms/templates/course/course-details.html @@ -1075,7 +1075,7 @@

${{course.price | floatformat:2}} class="btn btn-cart w-100">Add To Cart

@@ -1085,6 +1085,9 @@

${{course.price | floatformat:2}}

+ + +
@@ -1144,25 +1147,41 @@

Includes

-
+ + - - +{% endblock body %} +{% block bottom_js %} - + - + - - + + + -{% endblock body %} + + + + + + + + + + + + +{% endblock bottom_js %} From 6132ed3732417f665b0a06ae0c1f388450608030 Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Mon, 24 Oct 2022 07:15:04 +0100 Subject: [PATCH 6/7] updated settings,json --- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 12901f9..ae378c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,6 @@ { - "python.analysis.typeCheckingMode": "basic" + "python.analysis.typeCheckingMode": "basic", + "python.analysis.extraPaths": [ + "./equestlms" + ] } From e45235f016d0a176e89f7b488190cf46761d9205 Mon Sep 17 00:00:00 2001 From: officialksolomon Date: Mon, 24 Oct 2022 17:31:54 +0100 Subject: [PATCH 7/7] updated template and url param --- course/urls.py | 2 +- course/views.py | 18 +- .../templates/course/course-details.html | 519 +----------------- 3 files changed, 22 insertions(+), 517 deletions(-) diff --git a/course/urls.py b/course/urls.py index eca89af..91f95be 100644 --- a/course/urls.py +++ b/course/urls.py @@ -15,7 +15,7 @@ name="course-detail", ), path( - "handle-purchase//", + "handle-purchase//", view=course_view.HandlePurchaseView.as_view(), name="handle-purchase", ), diff --git a/course/views.py b/course/views.py index d58436f..468590f 100644 --- a/course/views.py +++ b/course/views.py @@ -1,7 +1,7 @@ from django.shortcuts import redirect from django.views.generic import DetailView, ListView from django.views import View -from .models import Course +from .models import ClassRoom, Course from django.core.mail import send_mail from django.contrib.auth import get_user_model from django.contrib import messages @@ -24,20 +24,30 @@ class CourseDetailView(DetailView): template_name = "course/course-details.html" context_object_name = "course" + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + course = Course.objects.get(slug=self.kwargs.get('slug')) + print(course) + context['classroom'] = ClassRoom.objects.get(course=course) + print("Me", context) + return super().get_context_data(**kwargs) + class HandlePurchaseView(View): """ Sends user details to admin admin and displays purchase status to user """ - def get(self, request, pk): - course = Course.objects.get(pk=pk) + def get(self, request, slug): + course = Course.objects.get(slug=slug) if request.user.is_authenticated: user = User.objects.get(pk=request.user.pk) # Email admin admin_email_details = { 'subject': 'COURSE PURCHASE NOTIFICATION', - 'message': f'A user with name {user} made a purchase request. \n User details are as follows: \n Email: {user.email}', # type: ignore + # type: ignore + # type: ignore + 'message': f'A user with name {user} made a purchase request. \n User details are as follows: \n Email: {user.email}', 'recipient_list': ['solomonuche42@gmail.com'], 'from_email': 'equestlms@equestlms.com' diff --git a/equestlms/templates/course/course-details.html b/equestlms/templates/course/course-details.html index aab1df0..09442ff 100644 --- a/equestlms/templates/course/course-details.html +++ b/equestlms/templates/course/course-details.html @@ -5,488 +5,6 @@
- -
-
- -
-
- -