Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f9fbef5
add fake 600x grades script
Jun 21, 2013
792bb67
move instructor views.py to views/legacy.py
Jun 21, 2013
29bf5d0
add new blank instructor dashboard 2
Jun 4, 2013
8a3af8f
add more info to course info section of instructor dash 2
Jun 4, 2013
be8491d
add default section to instructor dash 2
Jun 4, 2013
2df9321
add error log to instructor dash
Jun 4, 2013
fbc02df
add enrollment count to instructor dash, tweak error rendering on ins…
Jun 4, 2013
9f4b16f
refactor dashboard section for course info, add comments
Jun 4, 2013
62f0dd2
add deep linking to instructor dash, add buttons to data download of …
Jun 4, 2013
15f0e3e
remove prints from instructor dash, move glob info on instructor dash…
Jun 4, 2013
60d83eb
add instructor api endpoints, tweak instructor comments, tweak instru…
Jun 4, 2013
43710df
add coffeescript for data download section, add comments
Jun 4, 2013
68a2604
tweak presentation
Jun 4, 2013
8d29a17
add list profile summary to instructor dash
Jun 4, 2013
9c4ba7f
add profile_distribution endpoint, optimize queries
Jun 5, 2013
6e7187c
add more distributions to endpoint
Jun 5, 2013
bc6300e
add fronted for distributions, add comments
Jun 5, 2013
914a795
refactor from instructor views to analytics module
Jun 21, 2013
3472ee1
refactor from instructor views to analytics module (2)
Jun 10, 2013
b89f099
add test endpoint
Jun 10, 2013
a159dc2
add create_csv_response to analytics.basic
Jun 10, 2013
68c44e0
add useful names to html
Jun 10, 2013
1c64baa
fix extra list level
Jun 10, 2013
337fb47
add (noop) csv option, move data processing out of view
Jun 10, 2013
2b53627
add csv option for student profile list
Jun 10, 2013
44811f1
remove #'s
Jun 10, 2013
1dc7072
implement csv student list
Jun 10, 2013
ea381f3
change default query features
Jun 10, 2013
7b13095
add slickgrid assets
Jun 10, 2013
cf9190f
add slick grid
Jun 10, 2013
1a7c570
move and improve command add_fake_6002x_students
Jun 11, 2013
aaab231
fix slickgrid rendering
Jun 11, 2013
cef706f
add course info heading
Jun 11, 2013
03779c2
add flot graph
Jun 11, 2013
8c37901
add year_of_birth triangle distribution, add reattribute management c…
Jun 11, 2013
d7c28fe
restyle student admin
Jun 11, 2013
f024e4c
fix variable use
Jun 12, 2013
fa16eb2
add instructor.enrollment module
Jun 12, 2013
f9c4020
hide PID and version from instructor dash
Jun 13, 2013
c59b2d9
fix enrollment functions
Jun 13, 2013
b61052f
add test_enrollment, archive test
Jun 13, 2013
23a6fb8
add security to views, remove test method
Jun 13, 2013
af7bf29
remove unused imports
Jun 13, 2013
e0fa899
add condition for error course error display
Jun 13, 2013
f171bd1
add email to default downloaded features
Jun 13, 2013
c61d979
remove broken unprocessed status response, add comments
Jun 13, 2013
6c4399d
add batch enroll/unenroll functionality (works/fails silently to the …
Jun 13, 2013
3cb9aa8
add textarea for multiline input, dump json response for enrollment c…
Jun 13, 2013
a14bd9b
add batch enroll/unenroll display response
Jun 13, 2013
debadae
style enrollment section
Jun 14, 2013
c77e9fb
add instructor.access with tests
Jun 14, 2013
438617b
add access_allow_revoke api endpoint (untested)
Jun 14, 2013
12ab619
refactor template handling for easy reorder/disable/permissions
Jun 14, 2013
b3d1c69
rename enrollment section to membership
Jun 14, 2013
dcdfdd3
add list_with_level endpoint
Jun 17, 2013
44e6016
add fake 6002x staff script
Jun 17, 2013
d066d6e
add access comments
Jun 17, 2013
74e71fa
add staff management subsections
Jun 17, 2013
85e3f49
refactor analytics section to its own file
Jun 17, 2013
0cc5665
refactor analytics section to be an object
Jun 17, 2013
c89f2cd
add comments, clear email field after submit
Jun 17, 2013
bfc15aa
fix js import
Jun 17, 2013
ee7cd68
refactor data download into its own file and object
Jun 17, 2013
95dadf8
refactor membership into its own file and object
Jun 17, 2013
fdefdcb
refactor membership to be OOP organized
Jun 18, 2013
a13da5c
add header click handler, fix squashed rendering of membership table
Jun 18, 2013
da36818
add student_admin section coffeescript and api views
Jun 19, 2013
4b5555c
add reset student attempts and delete student attempts buttons (and f…
Jun 20, 2013
80529fc
remove pid and version from old dash
Jun 20, 2013
0a8ecb4
add instructor dash version switch
Jun 20, 2013
f005e9f
add forum list and access control endpoints
Jun 20, 2013
bda4292
add forum admin list management (ugly)
Jun 20, 2013
4f22143
fix repoint dump_grades script
Jun 21, 2013
fab850b
move instructor legacy tests
Jun 21, 2013
0c74a22
fix flaky gradebook test
Jun 21, 2013
74afd98
add unit tests for new dashboard
Jun 21, 2013
269f23d
add beta to endpoint, rename endpoint
Jun 21, 2013
306d380
rename list copy
Jun 21, 2013
7ce5c3a
add beta list, remove extra js logging
Jun 21, 2013
8c1ea80
fix forum and admin API's to be more similar, add auto-enroll checkbo…
Jun 24, 2013
54eb50a
add course errors visibility toggle
Jun 24, 2013
1500334
tweak layout -> data download vertical
Jun 24, 2013
f449fd1
tweak analytics view
Jun 24, 2013
9ebcdfd
cleanup membership tab, add access control to forum lists
Jun 24, 2013
f1a06a1
add underscore check to coffescript exports
Jun 24, 2013
50ba923
add instructor tasks copy
Jun 24, 2013
ae7b3ce
add (some) instructor task management functionaity
Jun 25, 2013
f906442
squash to 44e6016: add fake staff option in comment
Jun 26, 2013
9f9e478
add list_instructor_tasks api endpoint
Jun 26, 2013
1933b92
add task history, mixup grid rendering, some cleanup
Jun 26, 2013
a86c9f9
tweak presentation
Jun 26, 2013
4befcfa
visual cleanup, api error cleanup
Jun 26, 2013
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
# creates users named johndoen with emails of jdn@edx.org
# they are enrolled in 600x and have fake grades with

from optparse import make_option
import json
import random
from datetime import datetime

from django.core.management.base import BaseCommand, CommandError
from django.db import transaction

from django.contrib.auth.models import User
from student.models import UserProfile, CourseEnrollment
from courseware.models import StudentModule


class Command(BaseCommand):

args = '<>'
help = """
Add fake students and grades to db.
"""

# option_list = BaseCommand.option_list + (
# make_option('--course_id',
# action='store',
# dest='course_id',
# help='Specify a particular course.'),
# make_option('--exam_series_code',
# action='store',
# dest='exam_series_code',
# default=None,
# help='Specify a particular exam, using the Pearson code'),
# make_option('--accommodation_pending',
# action='store_true',
# dest='accommodation_pending',
# default=False,
# ),
# )

@transaction.autocommit
def _create_jd(self, seed_num):
print (20 * "\n") + ("creating johndoe%s" % seed_num) + (20 * "\n")

course_id = 'MITx/6.002x/2013_Spring'
email = 'jd%s@edx.org' % seed_num
password = '1234'

user = User(username='johndoe%s' % seed_num, email=email, password=password)
user.save()

def get_year_of_birth():
if random.random() > 0.9:
return None
else:
return random.triangular(UserProfile.this_year - 100, UserProfile.this_year, UserProfile.this_year - 22)

profile = UserProfile(user=User.objects.filter(email=email)[0], name='John Doe %s' % seed_num)
profile.language = random.choice(["English", "English", "English", "English", "English", "English", "English", "English", "English", "French", "french", "Esperanto"])
profile.year_of_birth = get_year_of_birth()
# TODO why don't gender and level_of_educationin fail validation when switched to invalids?
profile.gender = random.choice([(None, None)] + list(profile.GENDER_CHOICES))[0]
profile.level_of_education = random.choice([(None, None)] + list(profile.LEVEL_OF_EDUCATION_CHOICES))[0]
profile.goals = random.choice([None, "Learn EE", "Conquer the world", "Find myself", "Explore the possiblity of becoming a well-rounded college application."])
profile.mailing_address = random.choice([None, "159 Hubler, Dr", "Ye ol' hunton", "44 poplar", "603 Small Apt., 02341"])
profile.save()

enrollment = CourseEnrollment(user=user, course_id=course_id)
enrollment.save()

for state_key in MODULE_STATE_KEYS:
# WARN: state and grade/max_grade are completely made up
smod = StudentModule(
module_type='problem',
module_state_key=state_key,
student=user,
course_id=course_id,
state={},
grade=random.choice(range(100+1)),
max_grade=100,
done='na')
smod.save()

def _create_n_jds(self, number_to_add):
print "adding fake users"

seed_num = 1
while number_to_add > 0:
if len(User.objects.filter(username='johndoe%s' % seed_num)) > 0:
seed_num += 1
else:
self._create_jd(seed_num)
number_to_add -= 1

def _delete_all_jds(self):
[student.delete() for student in User.objects.filter(username__contains="johndoe")]

def handle(self, *args, **options):
new_jds = int(args[0])

if 'delete' in args:
self._delete_all_jds()

if 'nocreate' in args:
pass
else:
self._create_n_jds(new_jds)


# set([sm.module_state_key for sm in SM.objects.filter(module_type='problem')])
MODULE_STATE_KEYS = set([
u'i4x://MITx/6.002x/problem/S14E4_Fall_Time',
u'i4x://MITx/6.002x/problem/S20E3_LCR_voltage_divider',
u'i4x://MITx/6.002x/problem/First-order_Transients',
u'i4x://MITx/6.002x/problem/H5P2_Source_Follower_Large_Signal',
u'i4x://MITx/6.002x/problem/S3E3_Circuit_Variables_are_Superpositions_of_values_due_to_each_source_separately',
u'i4x://MITx/6.002x/problem/S2E1_Circuit_Topology',
u'i4x://MITx/6.002x/problem/Resonance',
u'i4x://MITx/6.002x/problem/S5E2_Switch_Model',
u'i4x://MITx/6.002x/problem/S11E1_Small-Signal_MOSFET_Model',
u'i4x://MITx/6.002x/problem/S8E0_Dependent_Source',
u'i4x://MITx/6.002x/problem/H2P3_Logic_Circuits',
u'i4x://MITx/6.002x/problem/Second-order_Circuits',
u'i4x://MITx/6.002x/problem/S12E4_First-Order_Capacitor_Examples',
u'i4x://MITx/6.002x/problem/S14E1_Response_to_step_down',
u'i4x://MITx/6.002x/problem/H10P3_An_L_Network',
u'i4x://MITx/6.002x/problem/S17E1_Particular_Solution',
u'i4x://MITx/6.002x/problem/S7E2_Graphs',
u'i4x://MITx/6.002x/problem/H11P2_Scope_Probe',
u'i4x://MITx/6.002x/problem/S12E5_Neon_Relaxation_Oscillator',
u'i4x://MITx/6.002x/problem/S16E1_Charging_and_Discharging',
u'i4x://MITx/6.002x/problem/H9P1_Response_to_a_Delayed_Impulse',
u'i4x://MITx/6.002x/problem/S1E1_Various_V-I_characteristics',
u'i4x://MITx/6.002x/problem/Impedance_Frequency_Response',
u'i4x://MITx/6.002x/problem/S13E4_First-Order_Inductor_Examples',
u'i4x://MITx/6.002x/problem/S10E2_two_terminal_connection',
u'i4x://MITx/6.002x/problem/Propagation_Delay',
u'i4x://MITx/6.002x/problem/H2P2_Solar_Power',
u'i4x://MITx/6.002x/problem/H3P4_Diode_Limiter',
u'i4x://MITx/6.002x/problem/S7E1_Linearization',
u'i4x://MITx/6.002x/problem/S18E2_Homogenous_Equation_Solution',
u'i4x://MITx/6.002x/problem/S2E2_Associated_Reference_Directions',
u'i4x://MITx/6.002x/problem/S22E1_Which_output_',
u'i4x://MITx/6.002x/problem/H12P1_Current_Source',
u'i4x://MITx/6.002x/problem/S6E0_Thevenin_isolates_nonlinear_element',
u'i4x://MITx/6.002x/problem/S24E4_Generalization_to_impedances',
u'i4x://MITx/6.002x/problem/S16E2_Time_to_Decay',
u'i4x://MITx/6.002x/problem/S1E2_Power_copy',
u'i4x://MITx/6.002x/problem/Curve_Tracer',
u'i4x://MITx/6.002x/problem/H9P3_Designing_a_Shock_Absorber',
u'i4x://MITx/6.002x/problem/H4P2_Zener_Regulator',
u'i4x://MITx/6.002x/problem/S1E1.5_Simple_Power',
u'i4x://MITx/6.002x/problem/S26E1_Power_and_Energy_Review',
u'i4x://MITx/6.002x/problem/S6E3_Piecewise_Linear',
u'i4x://MITx/6.002x/problem/S1E6_KVL',
u'i4x://MITx/6.002x/problem/S15E5_Initial_Conditions',
u'i4x://MITx/6.002x/problem/Capacitors_and_Energy_Storage',
u'i4x://MITx/6.002x/problem/H3P3_Solar_Cell',
u'i4x://MITx/6.002x/problem/H11P1_LC_Tank',
u'i4x://MITx/6.002x/problem/Logic_Gate_Implementation',
u'i4x://MITx/6.002x/problem/S14E2_Rise_Time',
u'i4x://MITx/6.002x/problem/S12E3_Norton_Capacitor_Circuit',
u'i4x://MITx/6.002x/problem/S4E2_Boolean_Functions',
u'i4x://MITx/6.002x/problem/H10P2_New_Impedances',
u'i4x://MITx/6.002x/problem/S24E1_Summing_Amplifier',
u'i4x://MITx/6.002x/problem/S9E1_MOSFET_model',
u'i4x://MITx/6.002x/problem/S17E4_An_LC_circuit',
u'i4x://MITx/6.002x/problem/S2E6_Modeling',
u'i4x://MITx/6.002x/problem/S12E1_Scaling_Capacitors',
u'i4x://MITx/6.002x/problem/H8P1_Impulse',
u'i4x://MITx/6.002x/problem/S1E5_KVL-0',
u'i4x://MITx/6.002x/problem/S9E3_MOSFET_Amplifier_2',
u'i4x://MITx/6.002x/problem/S23E2_Inverting_Amplifier_analysis',
u'i4x://MITx/6.002x/problem/S3E4_Simple_Thevenin',
u'i4x://MITx/6.002x/problem/Q6Final2012',
u'i4x://MITx/6.002x/problem/S15E1_Review_A_Step_Up',
u'i4x://MITx/6.002x/problem/S17E3_Matching_Initial_Conditions',
u'i4x://MITx/6.002x/problem/H1P2_KCL-KVL_vs_Node_Method',
u'i4x://MITx/6.002x/problem/Lab_0_Using_the_Tools',
u'i4x://MITx/6.002x/problem/S21E3_Thevenin_Tank',
u'i4x://MITx/6.002x/problem/S14E3_Fall_Time_Constant',
u'i4x://MITx/6.002x/problem/Q2Final2012',
u'i4x://MITx/6.002x/problem/ex_practice_limited_checks',
u'i4x://MITx/6.002x/problem/H7P2_Time_Constants',
u'i4x://MITx/6.002x/problem/S15E3_Review_A_Pulse_is_Step_Up_then_Step_Down',
u'i4x://MITx/6.002x/problem/S1E2_Power',
u'i4x://MITx/6.002x/problem/S19E4_Magnitudes_and_Angles',
u'i4x://MITx/6.002x/problem/S19E1_Trigonometry_Isn_t_So_Bad',
u'i4x://MITx/6.002x/problem/S2E5_Node_Method',
u'i4x://MITx/6.002x/problem/S13E1_Scaling_Inductors',
u'i4x://MITx/6.002x/problem/ex_practice_limited_checks_3',
u'i4x://MITx/6.002x/problem/S3E6_Norton_Model',
u'i4x://MITx/6.002x/problem/MTQ6',
u'i4x://MITx/6.002x/problem/H12P2_Linear_Regulator',
u'i4x://MITx/6.002x/problem/S1E8_KCL',
u'i4x://MITx/6.002x/problem/Sample_Algebraic_Problem',
u'i4x://MITx/6.002x/problem/S26E2_Energy_Sourced_in_T1',
u'i4x://MITx/6.002x/problem/S13E3_Thevenin_Inductor_Circuit',
u'i4x://MITx/6.002x/problem/H6P2_Phase_Inverter',
u'i4x://MITx/6.002x/problem/H7P1_Series_and_Parallel_Inductors',
u'i4x://MITx/6.002x/problem/S6E2_Load_Line',
u'i4x://MITx/6.002x/problem/H11P3_Branch_Voltages',
u'i4x://MITx/6.002x/problem/S20E1_Inductor_Impedance',
u'i4x://MITx/6.002x/problem/S15E4_Area',
u'i4x://MITx/6.002x/problem/S12E2_Capacitors_Store_Energy',
u'i4x://MITx/6.002x/problem/Sample_Numeric_Problem',
u'i4x://MITx/6.002x/problem/S21E2_LR_filter',
u'i4x://MITx/6.002x/problem/H5P3_Source_Follower_Small_Signal',
u'i4x://MITx/6.002x/problem/S18E1_Particular_Solution',
u'i4x://MITx/6.002x/problem/L2Node0',
u'i4x://MITx/6.002x/problem/L2Node1',
u'i4x://MITx/6.002x/problem/L2Node2',
u'i4x://MITx/6.002x/problem/S1E9_Battery_Model',
u'i4x://MITx/6.002x/problem/S25E2_Relaxation_Oscillator_Frequency',
u'i4x://MITx/6.002x/problem/MTQ3',
u'i4x://MITx/6.002x/problem/MTQ2',
u'i4x://MITx/6.002x/problem/MTQ1',
u'i4x://MITx/6.002x/problem/H6P3_Series_and_Parallel_Capacitors',
u'i4x://MITx/6.002x/problem/MTQ5',
u'i4x://MITx/6.002x/problem/MTQ4',
u'i4x://MITx/6.002x/problem/S10E3_Small_Signal_Amplifier',
u'i4x://MITx/6.002x/problem/H10P1_Magnitude_and_Angle',
u'i4x://MITx/6.002x/problem/Q5Final2012',
u'i4x://MITx/6.002x/problem/Resistor_Divider',
u'i4x://MITx/6.002x/problem/H5P1_Zero-Offset_Amplifier',
u'i4x://MITx/6.002x/problem/Lab2b_Mixing_Two_Signals',
u'i4x://MITx/6.002x/problem/H2P1_Voltage-Divider_Design',
u'i4x://MITx/6.002x/problem/S17E5_An_ILC_circuit',
u'i4x://MITx/6.002x/problem/S24E3_Inverting_Amplifier_Generalized',
u'i4x://MITx/6.002x/problem/S19E3_Complex_Numbers',
u'i4x://MITx/6.002x/problem/H1P3_Poor_Workmanship',
u'i4x://MITx/6.002x/problem/S1E3_AC_power',
u'i4x://MITx/6.002x/problem/S9E2_Amplifier_1',
u'i4x://MITx/6.002x/problem/S2E4_Series_and_Parallel',
u'i4x://MITx/6.002x/problem/S8E2_Dependent_Voltage_Source',
u'i4x://MITx/6.002x/problem/S11E2_Small-Signal_Model_of_Diode-Connected_MOSFET',
u'i4x://MITx/6.002x/problem/H3P1_A_Logic_Family',
u'i4x://MITx/6.002x/problem/S3E1_Node_Equation_Review',
u'i4x://MITx/6.002x/problem/H12P3_Opamps_and_Filter_Design',
u'i4x://MITx/6.002x/problem/H4P1_Vacuum_Diode',
u'i4x://MITx/6.002x/problem/Q4Final2012',
u'i4x://MITx/6.002x/problem/S24E2_Difference_Amplifier',
u'i4x://MITx/6.002x/problem/H9P2_SOC',
u'i4x://MITx/6.002x/problem/S5E1_Logic_with_Switches',
u'i4x://MITx/6.002x/problem/S23E3_L23AmplifierInputResistance',
u'i4x://MITx/6.002x/problem/S25E1_Positive_Feedback_Gain',
u'i4x://MITx/6.002x/problem/Circuit_Sandbox',
u'i4x://MITx/6.002x/problem/S3E2_Circuit_Voltages_and_Currents_are_Linear_Combinations_of_Source_Strengths',
u'i4x://MITx/6.002x/problem/S5E3_SR_Model',
u'i4x://MITx/6.002x/problem/S11E3_Source_Follower_Again_',
u'i4x://MITx/6.002x/problem/S21E4_AM_Radio_Tuning',
u'i4x://MITx/6.002x/problem/Mosfet_Amplifier',
u'i4x://MITx/6.002x/problem/H4P3_Dependent_Source_Circuit',
u'i4x://MITx/6.002x/problem/Q1Final2012',
u'i4x://MITx/6.002x/problem/S20E2_RC_voltage_divider',
u'i4x://MITx/6.002x/problem/S1E7_KCL-0',
u'i4x://MITx/6.002x/problem/H8P2_Physiological_Model',
u'i4x://MITx/6.002x/problem/H8P3_Memory',
u'i4x://MITx/6.002x/problem/ex_practice_2',
u'i4x://MITx/6.002x/problem/ex_practice_3',
u'i4x://MITx/6.002x/problem/H6P1_The_NewFET_device',
u'i4x://MITx/6.002x/problem/S8E1_Dependent_Current_Source',
u'i4x://MITx/6.002x/problem/S18E3_Total_Solution',
u'i4x://MITx/6.002x/problem/H3P2_Graphical_Model_of_Inverter',
u'i4x://MITx/6.002x/problem/S23E1_Non-Inverting_Amplifier',
u'i4x://MITx/6.002x/problem/S22E2_The_filter_is_ringing',
u'i4x://MITx/6.002x/problem/S21E1_Second-order_impedance',
u'i4x://MITx/6.002x/problem/S20E4_LCR_voltage_divider_frequency_limits',
u'i4x://MITx/6.002x/problem/S15E2_Review_A_Step_Down',
u'i4x://MITx/6.002x/problem/S3E5_Thevenin_Model',
u'i4x://MITx/6.002x/problem/S4E3_Truth_Table',
u'i4x://MITx/6.002x/problem/S7E3_Linearization',
u'i4x://MITx/6.002x/problem/S2E3_Using_KVL_KCL_and_VI_constraints',
u'i4x://MITx/6.002x/problem/H7P3_The_Curse_of_Lead_Inductance',
u'i4x://MITx/6.002x/problem/S13E2_Inductors_Store_Energy',
u'i4x://MITx/6.002x/problem/S26E3_A_Hot_Processor',
u'i4x://MITx/6.002x/problem/S1E1.5_Simple_Power_copy',
u'i4x://MITx/6.002x/problem/S6E1_A_Nonlinear_Element',
u'i4x://MITx/6.002x/problem/S19E2_Exponentials_are_Nice',
u'i4x://MITx/6.002x/problem/S10E1_Incremental_Voltage',
u'i4x://MITx/6.002x/problem/Op_Amps',
u'i4x://MITx/6.002x/problem/S24E5_Generalization_to_nonlinear_elements',
u'i4x://MITx/6.002x/problem/Q3Final2012',
u'i4x://MITx/6.002x/problem/S17E2_Characteristic_Equation',
u'i4x://MITx/6.002x/problem/H1P1_Resistor_Combinations',
u'i4x://MITx/6.002x/problem/S1E1_Various_V-I_characteristics_copy'])

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# creates users named johndoen with emails of jdn@edx.org
# they are enrolled in 600x and have fake grades with

from optparse import make_option
import json
import random
from datetime import datetime

from django.core.management.base import BaseCommand, CommandError
from django.db import transaction

from django.contrib.auth.models import User
from student.models import UserProfile, CourseEnrollment
from courseware.models import StudentModule


class Command(BaseCommand):

args = '<>'
help = """
Add fake students and grades to db.
"""

# option_list = BaseCommand.option_list + (
# make_option('--course_id',
# action='store',
# dest='course_id',
# help='Specify a particular course.'),
# make_option('--exam_series_code',
# action='store',
# dest='exam_series_code',
# default=None,
# help='Specify a particular exam, using the Pearson code'),
# make_option('--accommodation_pending',
# action='store_true',
# dest='accommodation_pending',
# default=False,
# ),
# )

@transaction.autocommit
def _process_user(self, user):
def get_year_of_birth():
if random.random() > 0.9:
return None
else:
return random.triangular(UserProfile.this_year - 100, UserProfile.this_year, UserProfile.this_year - 22)

user.profile.year_of_birth = get_year_of_birth()
user.profile.save()

def handle(self, *args, **options):
map(self._process_user, User.objects.filter(username__contains="johndoe").select_related('profile'))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading