This fixes two bugs: inability to pass in fields in tuples, and the fact that the fields list may grow over time, with duplicate entries, causing severe performance problems.
* Previously, if authenticate() returned an HttpResponse the view would continue with execution and display results to unauthenticated users. * Now the response from authenticate() is stored and if something exists (which needs to be a response) execution is stopped and that response is sent directly to the user.
Sets are serialized into lists, for two reasons: * sets can't hold unhashable objects such as dicts into which the Models are usually serialized * sets aren't JSON serializable Also, there is no information loss if serializing into lists, as long as the receiver doesn't treat the ordering in any special way.
returns errors if form is not valid