Closed adrienbrunet closed 7 years ago
Original description:
This adds support to seamlessly pass django messages to an angular app via ajax.
You can either use the Middleware or a view decorator to add the current messages to the HttpResponse of an ajax request (when the response Content-Type is application/json).
Then the messages are extracted from the response data by a HttpInterceptor, which also returns the remaining data to it's original/expected format.
There's a demo page that needs more detail and also docs.
Cool stuff! I was thinking about this feature myself, but had no time to implement it. Many thanks to @jamesbrobb
Erf, I need to make it work and then we can all have a closer look at it.
@jrief tests pass now. =) Haven't tried it though, I don't really have the need for it right now. Would be great if you can have a look and merge it.
I'm going to add compatibility for django1.10 and we're good to go. Or at least, review it :smiling_imp:
a few day ago I started to merge that PR locally. However, I had to adopt a lot of code and then I was distracted with other work.
btw. I had a look at a possible implementation of the client part, http://jsfiddle.net/roopehakulinen/uxeg4nze/ how do you like that?
That's neat! Currently adding django1.10 support. We'll see then what we can do. :)
:+1:
This is entirely @jamesbrobb work. I just rebased his work on our current master to get rid of the merge conflicts.
Now that we're able to merge, it could be a nice addition. What do you think @jrief and @jkosir ?
Note: I've just read quickly the code, haven't tested it yet.