Skip to content

Instantly share code, notes, and snippets.

@viadanna
viadanna / test_cohort.py
Created September 16, 2021 21:22
Testing Gendered Cohort assignment during enrollment
from openedx.core.djangoapps.course_groups.models import CohortMembership
from common.djangoapps.course_modes.models import CourseMode
from opaque_keys.edx.keys import CourseKey
from common.djangoapps.student.models import CourseEnrollment
from django.contrib.auth import get_user_model
def enroll(username='edx', course_key='course-v1:edX+DemoX+Demo_Course'):
user = get_user_model().objects.get(username=username)
@viadanna
viadanna / workshop-handout.md
Last active April 26, 2022 10:48
Handout for Periodic Reports Workshop

Periodic Reports Workshop

Welcome to the workshop. Here we'll get a hands-on approach on creating periodic reports on a sandbox provided by OpenCraft.

Sandbox Instructions

  1. Register an account on the provided sandbox

https://lilac-periodic-reports.opencraft.hosting

@viadanna
viadanna / case-sensitive.sql
Last active April 12, 2024 15:04
ALTER TABLE to make it case-sensitive
ALTER TABLE social_auth_usersocialauth MODIFY uid VARCHAR(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL
"""
# Confirming issue
from social_django.models import UserSocialAuth
>>> UserSocialAuth.objects.select_related("user").get(provider="edx-oauth2", uid="test1")
<UserSocialAuth: test1>
>>> UserSocialAuth.objects.select_related("user").get(provider="edx-oauth2", uid="TEST1")
<UserSocialAuth: test1>