Commit f8ce11a6 by Victor Shnayder

Add fixes to notes in #182

* use 'location' instead of 'id' in views.
* still need to change names in the coffeescript--quick fix didn't work
parent 97a24226
......@@ -68,12 +68,13 @@ def course_index(request, org, course, name):
@login_required
def edit_item(request):
# TODO (vshnayder): Why are we using "id" instead of "location"?
item_id = request.GET['id']
if not has_access(request.user, item_id):
# TODO (vshnayder): change name from id to location in coffee+html as well.
item_location = request.GET['id']
print item_location, request.GET
if not has_access(request.user, item_location):
raise Http404 # TODO (vshnayder): better error
item = modulestore().get_item(item_id)
item = modulestore().get_item(item_location)
return render_to_response('unit.html', {
'contents': item.get_html(),
'js_module': item.js_module_name(),
......@@ -100,17 +101,18 @@ def user_author_string(user):
@login_required
@expect_json
def save_item(request):
item_id = request.POST['id']
if not has_access(request.user, item_id):
item_location = request.POST['id']
if not has_access(request.user, item_location):
raise Http404 # TODO (vshnayder): better error
data = json.loads(request.POST['data'])
modulestore().update_item(item_id, data)
modulestore().update_item(item_location, data)
# Export the course back to github
# This uses wildcarding to find the course, which requires handling
# multiple courses returned, but there should only ever be one
course_location = Location(item_id)._replace(category='course', name=None)
course_location = Location(item_location)._replace(
category='course', name=None)
courses = modulestore().get_items(course_location, depth=None)
for course in courses:
author_string = user_author_string(request.user)
......
......@@ -88,7 +88,7 @@ end
# Per System tasks
desc "Run all django tests on our djangoapps for the #{system}"
task "test_#{system}" => ["#{system}:collectstatic:test", "fasttest_#{system}"]
task "test_#{system}" => ["#{system}:collectstatic:test", "fasttest_#{system}"]
# Have a way to run the tests without running collectstatic -- useful when debugging without
# messing with static files.
......
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