I have a python function in the view which gives an object, now I want to call this function with another function Which actually gives HttpResponse How can I return both python object and AJAX feedback simultaneously? The first way back to the python object. DIF populate_config_resources (): data = resource-manager.obages.filter (verified = 1) return data
returning another method httpresponse.
def Update_ResourceManager (request): Try: Except exceptions, do something ... e: Return HttpResponse (e) # Here I call that function. Config_data = populate_Config_Resources () HttpResponse ('success')
If you want an AJAX Response to that return value, then use it:
Returns http: // dumps (config_data), content_type = "application / json")
Or you are using a template:
template = loader .get_template ('config.html') context = RequestContext (request, {"config_data": config_data}) return HttpResponse (Template.render (context))
Comments
Post a Comment