diff --git a/apps/course/views.py b/apps/course/views.py index 19a46520..29fac3b0 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -6,4 +6,9 @@ from .models import Course class CoursesView(ListView): model = Course context_object_name = "course_items" - template_name = "templates/lilcity/courses.html" + paginate_by = 6 + + def get_template_names(self): + if self.request.is_ajax(): + return 'templates/lilcity/course_items.html' + return "templates/lilcity/courses.html" diff --git a/project/templates/lilcity/course_items.html b/project/templates/lilcity/course_items.html new file mode 100644 index 00000000..c2637f09 --- /dev/null +++ b/project/templates/lilcity/course_items.html @@ -0,0 +1,4 @@ +{% for course in course_items %} + {% cycle '' 'theme_green' 'theme_violet' as theme_color silent %} + {% include "templates/lilcity/_courses_item.html" %} +{% endfor %} \ No newline at end of file diff --git a/project/templates/lilcity/courses.html b/project/templates/lilcity/courses.html index 38cc093a..aa83ea58 100644 --- a/project/templates/lilcity/courses.html +++ b/project/templates/lilcity/courses.html @@ -56,13 +56,12 @@
- {% for course in course_items %} - {% cycle '' 'theme_green' 'theme_violet' as theme_color silent %} - {% include "templates/lilcity/_courses_item.html" %} - {% endfor %} + {% include "templates/lilcity/course_items.html" %}
- + {% if page_obj.has_next %} + + {% endif %}