Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
c520ab40
Commit
c520ab40
authored
Mar 28, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7 from aboudreault/xblock-saving-student-data
Fix student data is per mentoring, not shared
parents
a8b01cd6
3e84de32
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
mentoring/light_children.py
+3
-2
mentoring/migrations/0005_auto__chg_field_lightchild_name.py
+44
-0
mentoring/models.py
+1
-1
No files found.
mentoring/light_children.py
View file @
c520ab40
...
@@ -127,7 +127,7 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
...
@@ -127,7 +127,7 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
return
return
node
=
etree
.
parse
(
StringIO
(
self
.
xml_content
))
.
getroot
()
node
=
etree
.
parse
(
StringIO
(
self
.
xml_content
))
.
getroot
()
LightChildrenMixin
.
init_block_from_node
(
self
,
node
,
{}
)
LightChildrenMixin
.
init_block_from_node
(
self
,
node
,
node
.
items
()
)
def
get_children_objects
(
self
):
def
get_children_objects
(
self
):
"""
"""
...
@@ -302,11 +302,12 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -302,11 +302,12 @@ class LightChild(Plugin, LightChildrenMixin):
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
course_id
=
self
.
xmodule_runtime
.
course_id
course_id
=
self
.
xmodule_runtime
.
course_id
url_name
=
"
%
s-
%
s"
%
(
self
.
xblock_container
.
url_name
,
name
)
lightchild_data
,
created
=
LightChildModel
.
objects
.
get_or_create
(
lightchild_data
,
created
=
LightChildModel
.
objects
.
get_or_create
(
student_id
=
student_id
,
student_id
=
student_id
,
course_id
=
course_id
,
course_id
=
course_id
,
name
=
name
,
name
=
url_
name
,
)
)
return
lightchild_data
return
lightchild_data
...
...
mentoring/migrations/0005_auto__chg_field_lightchild_name.py
0 → 100644
View file @
c520ab40
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Changing field 'LightChild.name'
db
.
alter_column
(
'mentoring_lightchild'
,
'name'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
100
))
def
backwards
(
self
,
orm
):
# Changing field 'LightChild.name'
db
.
alter_column
(
'mentoring_lightchild'
,
'name'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
50
))
models
=
{
'mentoring.answer'
:
{
'Meta'
:
{
'unique_together'
:
"(('student_id', 'course_id', 'name'),)"
,
'object_name'
:
'Answer'
},
'course_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'created_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now'
:
'True'
,
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'student_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'db_index'
:
'True'
}),
'student_input'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
,
'blank'
:
'True'
})
},
'mentoring.lightchild'
:
{
'Meta'
:
{
'unique_together'
:
"(('student_id', 'course_id', 'name'),)"
,
'object_name'
:
'LightChild'
},
'course_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'created_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now'
:
'True'
,
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
,
'db_index'
:
'True'
}),
'student_data'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
,
'blank'
:
'True'
}),
'student_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'db_index'
:
'True'
})
}
}
complete_apps
=
[
'mentoring'
]
\ No newline at end of file
mentoring/models.py
View file @
c520ab40
...
@@ -61,7 +61,7 @@ class LightChild(models.Model):
...
@@ -61,7 +61,7 @@ class LightChild(models.Model):
app_label
=
'mentoring'
app_label
=
'mentoring'
unique_together
=
((
'student_id'
,
'course_id'
,
'name'
),)
unique_together
=
((
'student_id'
,
'course_id'
,
'name'
),)
name
=
models
.
CharField
(
max_length
=
5
0
,
db_index
=
True
)
name
=
models
.
CharField
(
max_length
=
10
0
,
db_index
=
True
)
student_id
=
models
.
CharField
(
max_length
=
32
,
db_index
=
True
)
student_id
=
models
.
CharField
(
max_length
=
32
,
db_index
=
True
)
course_id
=
models
.
CharField
(
max_length
=
50
,
db_index
=
True
)
course_id
=
models
.
CharField
(
max_length
=
50
,
db_index
=
True
)
student_data
=
models
.
TextField
(
blank
=
True
,
default
=
''
)
student_data
=
models
.
TextField
(
blank
=
True
,
default
=
''
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment