Commit d0c8722d by Piotr Mitros

Revert reversed. Database insert vs. update bug fixed

parent 98efb8c0
...@@ -107,17 +107,17 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -107,17 +107,17 @@ def render_x_module(user, request, xml_module, module_object_preload):
module_id=xml_module.get('id') #module_class.id_attribute) or "" module_id=xml_module.get('id') #module_class.id_attribute) or ""
# Grab state from database # Grab state from database
#s = object_cache(module_object_preload, s = object_cache(module_object_preload,
# user, user,
# module_type, module_type,
# module_id) module_id)
s = StudentModule.objects.filter(student=request.user, # s = StudentModule.objects.filter(student=request.user,
module_id=module_id, # module_id=module_id,
module_type = module_type) # module_type = module_type)
if len(s) == 0: # if len(s) == 0:
s=None # s=None
else: # else:
s=s[0] # s=s[0]
if s == None: # If nothing in the database... if s == None: # If nothing in the database...
state=None state=None
...@@ -141,6 +141,7 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -141,6 +141,7 @@ def render_x_module(user, request, xml_module, module_object_preload):
module_id=module_id, module_id=module_id,
state=instance.get_state()) state=instance.get_state())
smod.save() # This may be optional (at least in the case of no instance in the dB) smod.save() # This may be optional (at least in the case of no instance in the dB)
module_object_preload.append(smod)
# Grab content # Grab content
content = {'content':instance.get_html(), content = {'content':instance.get_html(),
"destroy_js":instance.get_destroy_js(), "destroy_js":instance.get_destroy_js(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment