handle responses in JS; clarify TODOs in views.py
This commit is contained in:
parent
a61d8dd6fe
commit
439b063cee
|
@ -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.'})
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user