This is a situation I've run into several times, not sure what the best approach is.
Let's say I have some kind of dynamic content that users can add to via Ajax. For example, take Stack Overflow's comments - people can add comments directly on to the page using Ajax.
The question is, how do I implement the addition itself of the new content. For example, it looks like the ajax call which Stack Overflow uses to add a comment, simply returns html which replaces all of the comments (not just the new one). This way saves redundant logic in the Javascript code which has to "know" what the html looks like.
Is this the best approach? If so, how best to implement it in Django so that there is no redundancy (i.e., so that the view doesn't have to know what the html looks like?)
Thanks!
EDIT: In my specific case, there is no danger of other comments being added in the meantime - this is purely a question of the best implementation.