Skip to content

Instantly share code, notes, and snippets.

@antoviaque
Created October 15, 2014 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save antoviaque/945bae6ce259ac77fafe to your computer and use it in GitHub Desktop.
Save antoviaque/945bae6ce259ac77fafe to your computer and use it in GitHub Desktop.
Getting real user ids from anonymous_student_id in edX/LMS
mysql> select * from mentoring_answer ORDER BY id DESC LIMIT 1;
+-----+------+----------------------------------+---------------+---------------------+---------------------+---------------------------+
| id | name | student_id | student_input | created_on | modified_on | course_id |
+-----+------+----------------------------------+---------------+---------------------+---------------------+---------------------------+
| 285 | goal | 949b5f1c92d026420c75a83a8021a78a | fdsgsdg | 2014-10-14 19:06:41 | 2014-10-14 19:06:44 | slashes:Asses+A10+2014_A1 |
+-----+------+----------------------------------+---------------+---------------------+---------------------+---------------------------+
1 row in set (0.00 sec)
mysql> Bye
(edxapp)edxapp@ip-10-254-1-132:~/edx-platform$ ./manage.py lms --settings=aws shell
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from student.models import user_by_anonymous_id
>>> user_by_anonymous_id('949b5f1c92d026420c75a83a8021a78a')
<User: progresstest3>
>>> user_by_anonymous_id('949b5f1c92d026420c75a83a8021a78a').__dict__
{'username': u'progresstest3', 'first_name': u'profname3', 'last_name': u'prolname3', 'is_active': True, '_state': <django.db.models.base.ModelState object at 0x6bacc10>, 'email': u'progresstest3@yopmail.com', 'is_superuser': False, 'is_staff': False, 'last_login': datetime.datetime(2014, 10, 14, 19, 6, 35, tzinfo=<UTC>), 'password': u'pbkdf2_sha256$10000$W3SUJ85gWUMK$qRBbhkS+YYAVtP/4y7gO+BSrdfRAj7rbufIsfPR2VgU=', 'id': 5014L, 'date_joined': datetime.datetime(2014, 7, 25, 13, 9, 37, tzinfo=<UTC>)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment