From d3292d096014c8d5795dfebc3fb82cef6786fb41 Mon Sep 17 00:00:00 2001 From: Ali Karbassi Date: Mon, 1 Jul 2019 17:23:52 -0500 Subject: [PATCH] Added Course types. - Separate course between Weekend and Summer Camps - Updated the programs page to have summer camps under it's section. - Added a Summer Camps page. (/programs/summer-camps/ & /summer-camps/) --- .vscode/extensions.json | 2 +- coderdojochi/admin.py | 2 + .../migrations/0025_course_course_type.py | 18 ++ coderdojochi/models.py | 42 ++- fixtures/01-coderdojochi-courses.json | 27 ++ fixtures/04-coderdojochi-session.json | 300 ++++++++---------- tasks.py | 4 +- .../weallcode/programs-summer-camps.html | 37 +++ weallcode/templates/weallcode/programs.html | 29 +- weallcode/urls.py | 21 +- weallcode/views.py | 61 +++- 11 files changed, 342 insertions(+), 201 deletions(-) create mode 100644 coderdojochi/migrations/0025_course_course_type.py create mode 100644 weallcode/templates/weallcode/programs-summer-camps.html diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7a2c04fb..24da9df1 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -9,7 +9,7 @@ // Docker: Adds syntax highlighting, commands, hover tips, and linting // for Dockerfile and docker-compose files - "PeterJausovec.vscode-docker", + "ms-azuretools.vscode-docker", // IntelliSense for CSS class names in HTML "Zignd.html-css-class-completion", diff --git a/coderdojochi/admin.py b/coderdojochi/admin.py index b2297dd3..c0b864c3 100644 --- a/coderdojochi/admin.py +++ b/coderdojochi/admin.py @@ -484,6 +484,7 @@ class CourseAdmin(ImportExportMixin, ImportExportActionModelAdmin): list_display = [ 'code', 'title', + 'course_type', 'slug', 'created_at', 'updated_at', @@ -491,6 +492,7 @@ class CourseAdmin(ImportExportMixin, ImportExportActionModelAdmin): list_filter = [ 'code', + 'course_type', ] ordering = [ diff --git a/coderdojochi/migrations/0025_course_course_type.py b/coderdojochi/migrations/0025_course_course_type.py new file mode 100644 index 00000000..cf609df3 --- /dev/null +++ b/coderdojochi/migrations/0025_course_course_type.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.2 on 2019-07-01 20:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('coderdojochi', '0024_session_cost'), + ] + + operations = [ + migrations.AddField( + model_name='course', + name='course_type', + field=models.CharField(choices=[('WE', 'Weekend'), ('CA', 'Camp')], default='WE', max_length=2, verbose_name='type'), + ), + ] diff --git a/coderdojochi/models.py b/coderdojochi/models.py index 4ec683a4..cfb5dc76 100644 --- a/coderdojochi/models.py +++ b/coderdojochi/models.py @@ -346,11 +346,25 @@ def is_within_gender_limitation(self, limitation): class Course(models.Model): + WEEKEND = 'WE' + CAMP = 'CA' + + COURSE_TYPE_CHOICES = [ + (WEEKEND, 'Weekend'), + (CAMP, 'Camp'), + ] + code = models.CharField( max_length=255, blank=True, null=True, ) + course_type = models.CharField( + 'type', + max_length=2, + choices=COURSE_TYPE_CHOICES, + default=WEEKEND, + ) title = models.CharField( max_length=255, ) @@ -410,13 +424,15 @@ def __str__(self): return self.name -GENDER_LIMITATION_CHOICES = ( - ('male', 'Male'), - ('female', 'Female'), -) +class Session(models.Model): + MALE = 'male' + FEMALE = 'female' + GENDER_LIMITATION_CHOICES = ( + (MALE, 'Male'), + (FEMALE, 'Female'), + ) -class Session(models.Model): course = models.ForeignKey( Course, on_delete=models.CASCADE, @@ -999,14 +1015,16 @@ def __str__(self): return self.name -EQUIPTMENTCONDITIONS = ( - ('working', 'Working'), - ('issue', 'Issue'), - ('unusable', 'Unusable'), -) - - class Equipment(models.Model): + WORKING = 'working' + ISSUE = 'issue' + UNUSABLE = 'unusable' + EQUIPTMENTCONDITIONS = [ + (WORKING, 'Working'), + (ISSUE, 'Issue'), + (UNUSABLE, 'Unusable'), + ] + uuid = models.CharField( max_length=255, verbose_name="UUID", diff --git a/fixtures/01-coderdojochi-courses.json b/fixtures/01-coderdojochi-courses.json index c034d0c8..344e221d 100644 --- a/fixtures/01-coderdojochi-courses.json +++ b/fixtures/01-coderdojochi-courses.json @@ -4,11 +4,38 @@ "pk": 1, "fields": { "code": "HTML 101", + "course_type": "WE", "title": "Choose Your Own Adventure", "slug": "choose-your-own-adventure", "description": "

Think HTML and CSS are something you'd find in alphabet soup? Ever wonder how the web can deliver everything from Minecraft maps to YouTube Videos? Eager to learn and ready to build?

\r\n\r\n

By the end of the session, students will understand how the language HTML, CSS, and Javascript work together to build the web. Students will develop an understanding of how HTML is used to define the structure of web pages. In keeping with We All Code's philosophy of learning-by-doing, students will use their knowledge to hack together their own \"Choose Your Own Adventure\" game.

", "created_at": "2013-01-01T00:00:00-06:00", "updated_at": "2013-01-01T00:00:00-06:00" } +}, +{ + "model": "coderdojochi.course", + "pk": 2, + "fields": { + "code": "2020 Summer Camp #1", + "course_type": "CA", + "title": "Choose Your Own Adventure", + "slug": "choose-your-own-adventure", + "description": "

Think HTML and CSS are something you'd find in alphabet soup? Ever wonder how the web can deliver everything from Minecraft maps to YouTube Videos? Eager to learn and ready to build?

\r\n\r\n

By the end of the session, students will understand how the language HTML, CSS, and Javascript work together to build the web. Students will develop an understanding of how HTML is used to define the structure of web pages. In keeping with We All Code's philosophy of learning-by-doing, students will use their knowledge to hack together their own \"Choose Your Own Adventure\" game.

", + "created_at": "2019-01-01T00:00:00-06:00", + "updated_at": "2019-01-01T00:00:00-06:00" + } +}, +{ + "model": "coderdojochi.course", + "pk": 3, + "fields": { + "code": "2020 Summer Camp #2", + "course_type": "CA", + "title": "Build your own game in JS", + "slug": "build-your-own-game-in-js", + "description": "

Campers learn the fundamentals of web technologies to create, code, and produce their own project. Camp ends with a special showcase presentation for family and friends.

Students work side-by-side with professionals in the field of computer science during this intensive, five-day workshops.They will learn not only the fundamentals of web technologies but will also experience how a real-world project moves through its lifecycle.

Every session provides students with an opportunity to take a hands-on approach to their projects.Working closely with mentors allows plenty of room for discussion and reflection on one another's work, ultimately presenting to peers, guests, family, and friends.

Only 20 Chicago youth will be in each cohort to allow a high level of individual mentor-to-student attention.

Tuition includes all camp workshops, equipment, and any materials needed.

", + "created_at": "2019-01-01T00:00:00-06:00", + "updated_at": "2019-01-01T00:00:00-06:00" + } } ] diff --git a/fixtures/04-coderdojochi-session.json b/fixtures/04-coderdojochi-session.json index ea96d1f9..d25b53ce 100644 --- a/fixtures/04-coderdojochi-session.json +++ b/fixtures/04-coderdojochi-session.json @@ -1,172 +1,134 @@ [ -{ - "model": "coderdojochi.session", - "pk": 1, - "fields": { - "course": 1, - "start_date": "2020-01-01T10:00:00-06:00", - "end_date": "2020-01-01T13:00:00-06:00", - "mentor_start_date": "2020-01-01T09:00:00-06:00", - "mentor_end_date": "2020-01-01T14:00:00-06:00", - "location": 1, - "capacity": 20, - "mentor_capacity": null, - "additional_info": "", - "teacher": 1, - "external_enrollment_url": "", - "is_active": true, - "is_public": true, - "password": "", - "partner_message": "", - "announced_date_mentors": null, - "announced_date_guardians": null, - "created_at": "2000-01-01T00:00:00-06:00", - "updated_at": "2000-01-01T00:00:00-06:00", - "image_url": "classes/0001.jpg", - "bg_image": "", - "mentors_week_reminder_sent": true, - "mentors_day_reminder_sent": true, - "gender_limitation": "male", - "min_age_limitation": 7, - "max_age_limitation": 17, - "waitlist_mentors": [], - "waitlist_students": [] + { + "model": "coderdojochi.session", + "pk": 1, + "fields": { + "course": 1, + "start_date": "2020-01-01T10:00:00-06:00", + "end_date": "2020-01-01T13:00:00-06:00", + "mentor_start_date": "2020-01-01T09:00:00-06:00", + "mentor_end_date": "2020-01-01T14:00:00-06:00", + "location": 1, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "image_url": "classes/0001.jpg", + "mentors_week_reminder_sent": true, + "mentors_day_reminder_sent": true, + "gender_limitation": "male", + "min_age_limitation": 7, + "max_age_limitation": 17 + } + }, + { + "model": "coderdojochi.session", + "pk": 2, + "fields": { + "course": 1, + "start_date": "2020-02-02T10:00:00-06:00", + "end_date": "2020-02-02T13:00:00-06:00", + "mentor_start_date": "2020-02-02T09:00:00-06:00", + "mentor_end_date": "2020-02-02T14:00:00-06:00", + "location": 1, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "image_url": "classes/0002.jpg", + "min_age_limitation": 7, + "max_age_limitation": 17 + } + }, + { + "model": "coderdojochi.session", + "pk": 3, + "fields": { + "course": 1, + "start_date": "2020-03-03T10:00:00-06:00", + "end_date": "2020-03-03T13:00:00-06:00", + "mentor_start_date": "2020-03-03T09:00:00-06:00", + "mentor_end_date": "2020-03-03T14:00:00-06:00", + "location": 2, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "image_url": "classes/0003.jpg", + "gender_limitation": "Male", + "min_age_limitation": 7, + "max_age_limitation": 17 + } + }, + { + "model": "coderdojochi.session", + "pk": 4, + "fields": { + "course": 1, + "start_date": "2020-04-04T10:00:00-06:00", + "end_date": "2020-04-04T13:00:00-06:00", + "mentor_start_date": "2020-04-04T09:00:00-06:00", + "mentor_end_date": "2020-04-04T14:00:00-06:00", + "location": 1, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "image_url": "classes/0004.jpg", + "min_age_limitation": 10, + "max_age_limitation": 16 + } + }, + { + "model": "coderdojochi.session", + "pk": 5, + "fields": { + "course": 1, + "start_date": "2020-05-05T10:00:00-06:00", + "end_date": "2020-05-05T13:00:00-06:00", + "mentor_start_date": "2020-05-05T09:00:00-06:00", + "mentor_end_date": "2020-05-05T14:00:00-06:00", + "location": 1, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "password": "password", + "partner_message": "

This is the message that is displayed on the password page

\r\n

The password below is password

", + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "image_url": "classes/0001.jpg", + "gender_limitation": "female", + "min_age_limitation": 10, + "max_age_limitation": 15 + } + }, + { + "model": "coderdojochi.session", + "pk": 6, + "fields": { + "course": 2, + "start_date": "2020-07-06T09:00:00-06:00", + "end_date": "2020-07-10T14:00:00-06:00", + "mentor_start_date": "2020-06-08T08:00:00-06:00", + "mentor_end_date": "2020-06-12T14:30:00-06:00", + "location": 2, + "capacity": 20, + "teacher": 1, + "is_active": true, + "is_public": true, + "created_at": "2000-01-01T00:00:00-06:00", + "updated_at": "2000-01-01T00:00:00-06:00", + "min_age_limitation": 7, + "max_age_limitation": 17 + } } -}, -{ - "model": "coderdojochi.session", - "pk": 2, - "fields": { - "course": 1, - "start_date": "2020-02-02T10:00:00-06:00", - "end_date": "2020-02-02T13:00:00-06:00", - "mentor_start_date": "2020-02-02T09:00:00-06:00", - "mentor_end_date": "2020-02-02T14:00:00-06:00", - "location": 1, - "capacity": 20, - "mentor_capacity": null, - "additional_info": "", - "teacher": 1, - "external_enrollment_url": "", - "is_active": true, - "is_public": true, - "password": "", - "partner_message": "", - "announced_date_mentors": null, - "announced_date_guardians": null, - "created_at": "2000-01-01T00:00:00-06:00", - "updated_at": "2000-01-01T00:00:00-06:00", - "image_url": "classes/0002.jpg", - "bg_image": "", - "mentors_week_reminder_sent": false, - "mentors_day_reminder_sent": false, - "gender_limitation": null, - "min_age_limitation": 7, - "max_age_limitation": 17, - "waitlist_mentors": [], - "waitlist_students": [] - } -}, -{ - "model": "coderdojochi.session", - "pk": 3, - "fields": { - "course": 1, - "start_date": "2020-03-03T10:00:00-06:00", - "end_date": "2020-03-03T13:00:00-06:00", - "mentor_start_date": "2020-03-03T09:00:00-06:00", - "mentor_end_date": "2020-03-03T14:00:00-06:00", - "location": 2, - "capacity": 20, - "mentor_capacity": null, - "additional_info": "", - "teacher": 1, - "external_enrollment_url": "", - "is_active": true, - "is_public": true, - "password": "", - "partner_message": "", - "announced_date_mentors": null, - "announced_date_guardians": null, - "created_at": "2000-01-01T00:00:00-06:00", - "updated_at": "2000-01-01T00:00:00-06:00", - "image_url": "classes/0003.jpg", - "bg_image": "", - "mentors_week_reminder_sent": false, - "mentors_day_reminder_sent": false, - "gender_limitation": "Male", - "min_age_limitation": 7, - "max_age_limitation": 17, - "waitlist_mentors": [], - "waitlist_students": [] - } -}, -{ - "model": "coderdojochi.session", - "pk": 4, - "fields": { - "course": 1, - "start_date": "2020-04-04T10:00:00-06:00", - "end_date": "2020-04-04T13:00:00-06:00", - "mentor_start_date": "2020-04-04T09:00:00-06:00", - "mentor_end_date": "2020-04-04T14:00:00-06:00", - "location": 1, - "capacity": 20, - "mentor_capacity": null, - "additional_info": "", - "teacher": 1, - "external_enrollment_url": "", - "is_active": true, - "is_public": true, - "password": "", - "partner_message": "", - "announced_date_mentors": null, - "announced_date_guardians": null, - "created_at": "2000-01-01T00:00:00-06:00", - "updated_at": "2000-01-01T00:00:00-06:00", - "image_url": "classes/0004.jpg", - "bg_image": "", - "mentors_week_reminder_sent": false, - "mentors_day_reminder_sent": false, - "gender_limitation": null, - "min_age_limitation": 10, - "max_age_limitation": 16, - "waitlist_mentors": [], - "waitlist_students": [] - } -}, -{ - "model": "coderdojochi.session", - "pk": 5, - "fields": { - "course": 1, - "start_date": "2020-05-05T10:00:00-06:00", - "end_date": "2020-05-05T13:00:00-06:00", - "mentor_start_date": "2020-05-05T09:00:00-06:00", - "mentor_end_date": "2020-05-05T14:00:00-06:00", - "location": 1, - "capacity": 20, - "mentor_capacity": 10, - "additional_info": "", - "teacher": 1, - "external_enrollment_url": "", - "is_active": true, - "is_public": true, - "password": "password", - "partner_message": "

This is the message that is displayed on the password page

\r\n

The password below is password

", - "announced_date_mentors": null, - "announced_date_guardians": null, - "created_at": "2000-01-01T00:00:00-06:00", - "updated_at": "2000-01-01T00:00:00-06:00", - "image_url": "classes/0001.jpg", - "bg_image": "", - "mentors_week_reminder_sent": false, - "mentors_day_reminder_sent": false, - "gender_limitation": "female", - "min_age_limitation": 10, - "max_age_limitation": 15, - "waitlist_mentors": [], - "waitlist_students": [] - } -} ] diff --git a/tasks.py b/tasks.py index ee35f858..de21ebac 100644 --- a/tasks.py +++ b/tasks.py @@ -22,13 +22,13 @@ def migrate(ctx): @task def load_fixtures(ctx): - if os.environ.get("ENABLE_DEV_FIXTURES", False): + if os.environ.get("ENABLE_DEV_FIXTURES"): ctx.run("python3 manage.py loaddata fixtures/*.json") @task def collect_static(ctx): - if not os.environ.get("DEBUG", False): + if not os.environ.get("DEBUG"): ctx.run("python3 manage.py collectstatic --no-input") diff --git a/weallcode/templates/weallcode/programs-summer-camps.html b/weallcode/templates/weallcode/programs-summer-camps.html new file mode 100644 index 00000000..ce167342 --- /dev/null +++ b/weallcode/templates/weallcode/programs-summer-camps.html @@ -0,0 +1,37 @@ +{% extends 'weallcode/_base.html' %} + +{% block page-class %}programs{% endblock %} + +{% block subheader %} + +{% endblock subheader %} + +{% block content %} + {% include "weallcode/snippets/hero_image.html" with src="weallcode/images/photos/hero-programs.jpg" alt="programs" %} + +
+
+

Summer Camps

+

During these week-long summer experiences, kids get the chance to practice in-depth skills like project management, quality assurance, and teamwork while tackling a coding project.

+ + {% if summer_camp_classes %} + {% for session in summer_camp_classes %} + {% include "weallcode/snippets/class.html" with session=session %} + {% endfor %} + {% else %} +

There are no upcoming summer camps at this time. Please contact us for more information.

+ {% endif %} + + {% include "weallcode/snippets/posters.html" with svg_href_1="#svg-management" title_1="Project Management" content_1="Kids learn to manage the moving parts of a project." svg_href_2="#svg-backend" title_2="Quality Assurance" content_2="We teach kids the right way to complete a project." svg_href_3="#svg-high5" title_3="Socialization Skills" content_3="Kids spend the week completing a project in teams and making new friends." %} +
+
+{% endblock content %} diff --git a/weallcode/templates/weallcode/programs.html b/weallcode/templates/weallcode/programs.html index 7ed55620..081648e9 100644 --- a/weallcode/templates/weallcode/programs.html +++ b/weallcode/templates/weallcode/programs.html @@ -43,8 +43,8 @@

Programs

Upcoming Classes

- {% if sessions %} - {% for session in sessions %} + {% if weekend_classes %} + {% for session in weekend_classes %} {% include "weallcode/snippets/class.html" with session=session %} {% endfor %} {% else %} @@ -53,6 +53,23 @@

Upcoming Classes

+
+
+

Summer Camps

+

During these week-long summer experiences, kids get the chance to practice in-depth skills like project management, quality assurance, and teamwork while tackling a coding project.

+ + {% if summer_camp_classes %} + {% for session in summer_camp_classes %} + {% include "weallcode/snippets/class.html" with session=session %} + {% endfor %} + {% else %} +

There are no upcoming summer camps at this time. Please contact us for more information.

+ {% endif %} + + {% include "weallcode/snippets/posters.html" with svg_href_1="#svg-management" title_1="Project Management" content_1="Kids learn to manage the moving parts of a project." svg_href_2="#svg-backend" title_2="Quality Assurance" content_2="We teach kids the right way to complete a project." svg_href_3="#svg-high5" title_3="Socialization Skills" content_3="Kids spend the week completing a project in teams and making new friends." %} +
+
+

Pathways

@@ -171,12 +188,4 @@
Pathways
-
-
-

Summer Camps

-

During these week-long summer experiences, kids get the chance to practice in-depth skills like project management, quality assurance, and teamwork while tackling a coding project.

- - {% include "weallcode/snippets/posters.html" with svg_href_1="#svg-management" title_1="Project Management" content_1="Kids learn to manage the moving parts of a project." svg_href_2="#svg-backend" title_2="Quality Assurance" content_2="We teach kids the right way to complete a project." svg_href_3="#svg-high5" title_3="Socialization Skills" content_3="Kids spend the week completing a project in teams and making new friends." %} -
-
{% endblock content %} diff --git a/weallcode/urls.py b/weallcode/urls.py index 2dd4307d..ea7a4987 100644 --- a/weallcode/urls.py +++ b/weallcode/urls.py @@ -1,13 +1,30 @@ +from django.conf.urls import include from django.urls import path +from django.views.generic import RedirectView -from .views import CreditsView, GetInvolvedView, HomeView, OurStoryView, PrivacyView, ProgramsView, TeamView +from .views import ( + CreditsView, + GetInvolvedView, + HomeView, + OurStoryView, + PrivacyView, + ProgramsSummerCampsView, + ProgramsView, + TeamView, +) urlpatterns = [ path('', HomeView.as_view(), name='weallcode-home'), path('our-story/', OurStoryView.as_view(), name='weallcode-our-story'), - path('programs/', ProgramsView.as_view(), name='weallcode-programs'), + path('programs/', include([ + path('', ProgramsView.as_view(), name='weallcode-programs'), + path('summer-camps/', ProgramsSummerCampsView.as_view(), name='weallcode-programs-summer-camps'), + ])), path('team/', TeamView.as_view(), name='weallcode-team'), path('get-involved/', GetInvolvedView.as_view(), name='weallcode-get-involved'), path('privacy/', PrivacyView.as_view(), name='weallcode-privacy'), path('credits/', CreditsView.as_view(), name='weallcode-credits'), + + # Redirect /summer-camps/ to /programs/summer-camps/ + path('summer-camps/', RedirectView.as_view(pattern_name='weallcode-programs-summer-camps')), ] diff --git a/weallcode/views.py b/weallcode/views.py index 33dd67ae..b06a455b 100644 --- a/weallcode/views.py +++ b/weallcode/views.py @@ -8,7 +8,7 @@ from meta.views import MetadataMixin -from coderdojochi.models import Mentor, Session +from coderdojochi.models import Course, Mentor, Session from .forms import ContactForm @@ -78,18 +78,69 @@ class ProgramsView(MetadataMixin, TemplateView): def get_context_data(self, **kwargs): context = super(ProgramsView, self).get_context_data(**kwargs) - sessions = Session.objects.filter( + # WEEKEND CLASSES + weekend_classes = Session.objects.filter( is_active=True, - end_date__gte=timezone.now() + end_date__gte=timezone.now(), + course__course_type=Course.WEEKEND, ).order_by('start_date') if ( not self.request.user.is_authenticated or not self.request.user.role == 'mentor' ): - sessions = sessions.filter(is_public=True) + weekend_classes = weekend_classes.filter(is_public=True) + + context['weekend_classes'] = weekend_classes + + # SUMMER CAMP CLASSES + summer_camp_classes = Session.objects.filter( + is_active=True, + end_date__gte=timezone.now(), + course__course_type=Course.CAMP, + ).order_by('start_date') + + if ( + not self.request.user.is_authenticated or + not self.request.user.role == 'mentor' + ): + summer_camp_classes = summer_camp_classes.filter(is_public=True) + + context['summer_camp_classes'] = summer_camp_classes + + return context + + +class ProgramsSummerCampsView(MetadataMixin, TemplateView): + template_name = "weallcode/programs-summer-camps.html" + title = f"Summer Camps | {settings.SITE_NAME}" + description = ( + "We All Code is volunteer run nonprofit organization that teaches web, game, and app development to " + "youth ages 7 to 17 free of charge." + ) + image = "weallcode/images/photos/real-coding-skills.jpg" + twitter_card = "summary_large_image" + twitter_site = "@weallcode" + twitter_creator = "@weallcode" + url = reverse_lazy('weallcode-programs-summer-camps') + + def get_context_data(self, **kwargs): + context = super(ProgramsSummerCampsView, self).get_context_data(**kwargs) + + # SUMMER CAMP CLASSES + summer_camp_classes = Session.objects.filter( + is_active=True, + end_date__gte=timezone.now(), + course__course_type=Course.CAMP, + ).order_by('start_date') + + if ( + not self.request.user.is_authenticated or + not self.request.user.role == 'mentor' + ): + summer_camp_classes = summer_camp_classes.filter(is_public=True) - context['sessions'] = sessions + context['summer_camp_classes'] = summer_camp_classes return context