handle responses in JS; clarify TODOs in views.py

This commit is contained in:
Sanj 2011-09-01 08:30:49 +05:30
parent a61d8dd6fe
commit 439b063cee
2 changed files with 7 additions and 4 deletions

View File

@ -134,7 +134,7 @@ def add_relation(request):
relation = request.GET.get("relation", "")
if feature1 == None or feature2 == None or not request.user.is_staff(): #TODO: split up errors :/ -- not imp.
return render_to_json_response({'error': 'bad request'})
#TODO: handle saving m2m between feature1 and feature2 with relation
#TODO: handle saving m2m between feature1 and feature2 with relation. BIG QUESTION: Here it can also deal with is_primary logic - if it sets stuff to is_primary or not, though, this needs to be conveyed to the front-end / a logic figured out to toggle the check-boxes display.
return render_to_json_response({'success': 'relation made successfully.'})

View File

@ -60,9 +60,12 @@ function getRow(d) {
'feature2': feature2,
'relation': relation
}, function(response) {
});
if (response.error) {
alert(response.error);
} else {
alert(response.success);
}
});
});
return $tr;