Example #1
0
File: views.py Project: NateWr/rua
def get_authors(request, submission_id):
    if request.is_ajax():
        q = request.GET.get('term', '')
        data = json.dumps(logic.get_author_emails(submission_id,q))
    else:
        data = 'Unable to get authors'
    mimetype = 'application/json'
    return HttpResponse(data, mimetype)
Example #2
0
File: views.py Project: NateWr/rua
def get_all(request, submission_id):
    submission = get_object_or_404(models.Book, pk=submission_id)
    if request.is_ajax():
        q = request.GET.get('term', '')
        onetasker_results = logic.get_onetasker_emails(submission_id,q)
        editor_results = logic.get_editor_emails(submission_id,q)
        author_results = logic.get_author_emails(submission_id,q)
        results = []
        for user in onetasker_results:
        	if not string_any(user['value'] in result['value'] for result in results):

        	   results.append(user)
        for author in author_results:
        	if not string_any(author['value'] in result['value'] for result in results):
        	    results.append(author)
        	    
        for editor in editor_results:
        	if not string_any(editor['value'] in result['value'] for result in results):
        	    results.append(editor)
        data = json.dumps(results)
    else:
        data = 'Unable to get any user'
    mimetype = 'application/json'
    return HttpResponse(data, mimetype)