mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
5.4 KiB
JSON
1 line
5.4 KiB
JSON
[{"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001734.3308611, "message": "then:\nxhr = $.post('/create/some/object/');\nif(xhr.getResponseHeader('X-FORM-VALID')) alert('Form is valid');", "group_id": 81, "id": 841819}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001397.7029419, "message": "but it seems cleaner to me to indicate the success or failure state of the form in a response header, and have the form contents be the entire response body", "group_id": 81, "id": 841784}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001812.092973, "message": "turns out to be much more clean, especially when handling ajax requests from the new CreateView class-based generic view.", "group_id": 81, "id": 841828}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001351.865962, "message": "I see the error state sent to the browser mostly via JSON, with the form HTML in an attribute on the JSON object", "group_id": 81, "id": 841779}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001425.4114151, "message": "I'm just looking for opinions on the header approach.", "group_id": 81, "id": 841787}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001668.829932, "message": "What i'm doing is basically:\nresponse['X-FORM-VALID'] = True\nreturn response", "group_id": 81, "id": 841810}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304001674.1701031, "message": "in the view", "group_id": 81, "id": 841813}, {"user_id": 13325, "stars": [], "topic_id": 21801, "date_created": 1304002693.4650531, "message": "In my latest project I'm using the new class views, so this will give me an excuse to see how flexible the ModelForm view is.", "group_id": 81, "id": 842028}, {"user_id": 13325, "stars": [], "topic_id": 21801, "date_created": 1304002511.7747691, "message": "This is a great idea. I'll have to try it out.", "group_id": 81, "id": 841960}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304002917.5960751, "message": "I've really liked the ModelForm view so far", "group_id": 81, "id": 842079}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304002932.3471079, "message": "overriding form_valid() and form_invalid() is very powerful", "group_id": 81, "id": 842082}, {"user_id": 5980, "stars": [{"date_created": 1304035386.3729091, "user_id": 927}, {"date_created": 1304093983.0198441, "user_id": 141}], "topic_id": 21801, "date_created": 1304020817.2572629, "message": "Rather than using custom HTTP headers, you should probably just return HTTP status code 400 (the \"generic client side error status\") - see http://stackoverflow.com/questions/1959947/", "group_id": 81, "id": 846512}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022090.478399, "message": "which is also more correct, but certainly a backwards-incompatible change", "group_id": 81, "id": 846731}, {"user_id": 5980, "stars": [], "topic_id": 21801, "date_created": 1304020909.9726009, "message": "Just return an HttpResponseBadRequest from your view", "group_id": 81, "id": 846530}, {"user_id": 5980, "stars": [], "topic_id": 21801, "date_created": 1304021783.1116281, "message": "Yes, I meant it *should*, not it *does*! Hmm, maybe a patch needed. But yeah, 400 seems to be the most appropriate response code, and it's definitely more correct than using a custom header.", "group_id": 81, "id": 846652}, {"user_id": 5980, "stars": [], "topic_id": 21801, "date_created": 1304020945.999207, "message": "In fact, I'm pretty sure that Django 1.3's FormMixin generic view class should do this in its form_invalid method..", "group_id": 81, "id": 846543}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304021536.8824711, "message": "@j4mie I looked into that briefly because I thought there may be an appropriate 4## code, but didn't find one. I guess 400 would work.", "group_id": 81, "id": 846615}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304021630.273864, "message": "yeah, it just runs self.render_to_response with the form in the context.", "group_id": 81, "id": 846624}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304021566.6204171, "message": "I don't think FormMixin returns that code by default. Perhaps you're right that it should though.", "group_id": 81, "id": 846620}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022076.0570791, "message": "yeah. it probably won't change. would change a lot of JS if it did. I believe jQuery would fire the error callback instead of the success for AJAX requests.", "group_id": 81, "id": 846726}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022130.895293, "message": "I was actually also just looking into providing response metadata as JSON in a response header.", "group_id": 81, "id": 846746}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022197.745393, "message": "like: response['X-JSON-Test'] = json.dumps({'dude':'abides', 'donny':'out of element'})", "group_id": 81, "id": 846761}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022225.212913, "message": "or more likely response['X-Metadata']", "group_id": 81, "id": 846776}, {"user_id": 1963, "stars": [], "topic_id": 21801, "date_created": 1304022142.879683, "message": "trying to find out how much info you're allowed to shove in a header", "group_id": 81, "id": 846747}] |