Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 159 additions & 149 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions coderdojochi/admin.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,7 +534,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_select_related = [
'course',
'location',
'teacher',
'instructor',
]

ordering = [
Expand All@@ -549,7 +549,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
autocomplete_fields = [
'course',
'location',
'teacher',
# 'instructor',
]

search_fields = [
Expand All@@ -572,7 +572,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'mentor_end_date',
'capacity',
'mentor_capacity',
'teacher',
'instructor',
'is_active',
'is_public',
),
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/factories.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ class SessionFactory(factory.DjangoModelFactory):
mentor_start_date = datetime.now(utc)
mentor_end_date = datetime.now(utc)
password = ''
teacher = factory.SubFactory(MentorFactory)
instructor = factory.SubFactory(MentorFactory)

class Meta:
model = Session
Expand Down
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0026_teacher_to_instructor.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-22 23:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0025_course_course_type'),
]

operations = [
migrations.RenameField(
model_name='session',
old_name='teacher',
new_name='instructor',
),
]
19 changes: 19 additions & 0 deletions coderdojochi/migrations/0027_instructor_limit_choiced_to.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-10-24 22:00

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0026_teacher_to_instructor'),
]

operations = [
migrations.AlterField(
model_name='session',
name='instructor',
field=models.ForeignKey(limit_choices_to={'user__groups__name': 'Instructor'}, on_delete=django.db.models.deletion.CASCADE, related_name='session_instructor', to='coderdojochi.Mentor'),
),
]
17 changes: 17 additions & 0 deletions coderdojochi/migrations/0028_rename_race_ethnicity.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2019-10-24 22:01

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('coderdojochi', '0027_instructor_limit_choiced_to'),
]

operations = [
migrations.AlterModelOptions(
name='raceethnicity',
options={'verbose_name': 'Race/Ethnicity', 'verbose_name_plural': 'Race/Ethnicities'},
),
]
20 changes: 11 additions & 9 deletions coderdojochi/models.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,13 +12,14 @@

from stdimage.models import StdImageField

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)


class CDCUser(AbstractUser):

ROLE_CHOICES = (
('mentor', 'mentor'),
('guardian', 'guardian'),
)

role = models.CharField(
choices=ROLE_CHOICES,
max_length=10,
Expand DownExpand Up@@ -54,8 +55,8 @@ class RaceEthnicity(models.Model):
)

class Meta:
verbose_name = _("race ethnicity")
verbose_name_plural = _("race ethnicities")
verbose_name = _("Race/Ethnicity")
verbose_name_plural = _("Race/Ethnicities")

def __str__(self):
return self.race_ethnicity
Expand DownExpand Up@@ -479,10 +480,11 @@ class Session(models.Model):
null=True,
help_text="Basic HTML allowed"
)
teacher = models.ForeignKey(
instructor = models.ForeignKey(
Mentor,
related_name="session_teacher",
on_delete=models.CASCADE,
related_name="session_instructor",
limit_choices_to={'user__groups__name': "Instructor"},
)
waitlist_mentors = models.ManyToManyField(
Mentor,
Expand Down
8 changes: 4 additions & 4 deletions coderdojochi/social_account_adapter.py
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.contrib.auth import get_user_model

from coderdojochi.models import CDCUser

User = get_user_model()

class SocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
Expand DownExpand Up@@ -33,10 +33,10 @@ def pre_social_login(self, request, sociallogin):
# email = sociallogin.account.extra_data['email'].lower()
# email_address = EmailAddress.objects.get(email__iexact=email)
email = sociallogin.account.extra_data['email'].lower()
user = CDCUser.objects.get(email__iexact=email)
user = User.objects.get(email__iexact=email)

# if it does not, let allauth take care of this new social account
except CDCUser.DoesNotExist:
except User.DoesNotExist:
return

# if it does, connect this new social login to the existing user
Expand Down
22 changes: 11 additions & 11 deletions coderdojochi/static/css/cdc.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,16 +15,16 @@
*/
.container,
.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
zoom: 1;
}

.container:before,
.row:before,
.page-class-detail .teachers .teacher:before,
.page-class-detail .instructors .instructor:before,
.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
display: block;
overflow: hidden;

Expand All@@ -35,7 +35,7 @@

.container:after,
.row:after,
.page-class-detail .teachers .teacher:after {
.page-class-detail .instructors .instructor:after {
clear: both;
}

Expand DownExpand Up@@ -714,7 +714,7 @@ a.unstyled {
}

.row,
.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 10px 0;
}

Expand DownExpand Up@@ -1627,40 +1627,40 @@ a.icon-action:hover {
background: #F8F8F8;
}

.page-class-detail .teachers {
.page-class-detail .instructors {
overflow: hidden;

margin-bottom: 40px;
}

.page-class-detail .teachers .teacher {
.page-class-detail .instructors .instructor {
margin: 0 0 10px 0;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .image {
.page-class-detail .instructors .instructor .image {
float: left;

width: 49.15254%;
margin-right: 1.69492%;
}
}

.page-class-detail .teachers .teacher .image img {
.page-class-detail .instructors .instructor .image img {
width: 100%;
height: auto;
}

@media (min-width: 768px) {
.page-class-detail .teachers .teacher .info {
.page-class-detail .instructors .instructor .info {
float: right;

width: 49.15254%;
margin-right: 0;
}
}

.page-class-detail .teachers .teacher .info .subtitle {
.page-class-detail .instructors .instructor .info .subtitle {
margin: 0 0 30px;
}

Expand Down
4 changes: 3 additions & 1 deletion coderdojochi/templates/dashboard/admin.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,7 +154,8 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<th rowspan="2" class="col-sm-2">Date</th>
<th rowspan="2" class="col-sm-1 text-right">S. Time</th>
<th rowspan="2" class="col-sm-1 text-right">E. Time</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Class Name</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Course</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Instructor</th>
<th rowspan="2" class="col-sm-3 hidden-xs hidden-sm">Location</th>
<th rowspan="2" class="hidden-xs hidden-sm"></th>
<th colspan="3" class="text-center">Students</th>
Expand DownExpand Up@@ -191,6 +192,7 @@ <h2 class="title text-left">Classes <span class="badge">{{ sessions.count }}</sp
<td class="text-right">{{ session.start_date|time:"H:i" }}</td>
<td class="text-right">{{ session.end_date|time:"H:i" }}</td>
<td class="hidden-xs hidden-sm"><a href="{{ session.get_absolute_url }}">{{ session.course.title }}</a></td>
<td>{{ session.instructor }}</td>
<td class="hidden-xs hidden-sm">{{ session.location.name }}</td>
<td class="text-center hidden-xs hidden-sm">
{% if session.announced_date_guardians|yesno:'yes,no' == 'yes' %}
Expand Down
2 changes: 1 addition & 1 deletion coderdojochi/templates/faqs.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ <h2 class="title">What level of code you are offering at classes?</h2>
<p>Our Dojo develops content to suit the students and mentors in attendance. We All Code recommends HTML as a good starting point to demonstrate to kids that they can actually create content. This will encourage progression into more complex programming with functions/loops/variables etc.</p>

<h2 class="title">Who are the volunteers?</h2>
<p>Volunteers include parents, teachers and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>
<p>Volunteers include parents, teachers, and programmers from the industry who are enthusiastic about helping kids to develop their coding skills.</p>

<h2 class="title">Can I stay with my child during the class?</h2>
<p>Yes! We highly encourage parents to stay with their children throughout the process. This allows everyone to learn something new and amazing!</p>
Expand Down
14 changes: 7 additions & 7 deletions coderdojochi/templates/session-detail.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,16 +138,16 @@ <h5 class="text-uppercase margin-top-2"><a class="text-white" href="{% url 'faqs
</div>

<section class="margin-top-3">
{% if session.teacher %}
<h3 class="title text-secondary">About the teacher</h3>
<div class="grid-x teacher grid-margin-x grid-margin-y margin-top-2">
{% if session.instructor %}
<h3 class="title text-secondary">About the instructor</h3>
<div class="grid-x instructor grid-margin-x grid-margin-y margin-top-2">
<div class="cell small-4 medium-3 image">
<a href="{% url 'mentor-detail' session.teacher.id %}"><img class="width-100 thumbnail" src="{% if session.teacher.avatar %}{{ session.teacher.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.teacher.user.first_name }} {{ session.teacher.last_name }}"></a>
<a href="{% url 'mentor-detail' session.instructor.id %}"><img class="width-100 thumbnail" src="{% if session.instructor.avatar %}{{ session.instructor.avatar.thumbnail.url }}{% else %}https://gravatar.com/avatar/?s=320&d=mm{% endif %}" alt="Photo of session.instructor }}"></a>
</div>
<div class="cell small-8 medium-9 padding-top-1">
<h4 class="subtitle">{{ session.teacher.user.first_name }} {{ session.teacher.last_name }}</h4>
<p>{{ session.teacher.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.teacher.id %}">Learn more about {{ session.teacher.user.first_name }}.</a></p>
<h4 class="subtitle">{{ session.instructor }}</h4>
<p>{{ session.instructor.bio|truncatechars:120 }}</p>
<p><a href="{% url 'mentor-detail' session.instructor.id %}">Learn more about {{ session.instructor.user.first_name }}.</a></p>
</div>
</div>
{% endif %}
Expand Down
7 changes: 4 additions & 3 deletions coderdojochi/util.py
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
import logging

from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils import timezone
Expand All@@ -10,6 +11,8 @@

logger = logging.getLogger(__name__)

User = get_user_model()


def email(
subject,
Expand DownExpand Up@@ -98,14 +101,12 @@ def email(
f"user: {recipient}, {timezone.now()}"
)

from coderdojochi.models import CDCUser
user = CDCUser.objects.get(email=recipient)
user = User.objects.get(email=recipient)
user.is_active = False
user.admin_notes = f"User '{send_attempt.reject_reason}' when checked on {timezone.now()}"
user.save()



def batches(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
2 changes: 1 addition & 1 deletion fixtures-prod/get.sh
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,5 +25,5 @@ models=(

for i in "${!models[@]}"
do
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "$i-${models[$i]}.json"
heroku run --app production-wac python -W ignore manage.py dumpdata "${models[$i]}" --indent 2 -- > "`printf %02d $i`-${models[$i]}.json"
done
File renamed without changes.
Loading