I'm wondering what a controller - such as the following Rails controller - would look like in Django, to perform an ajax update of the page after an asynchronous form submission (assuming the following is correct):
def create
@omelet = Omelet.new(params[:omelet])
render :update do |page|
if @omelet.save
page.replace_html 'notice', 'Omelet was successfully cooked'
else
page.replace_html 'notice', 'Sorry - the omelet could not be cooked'
end
page.replace_html 'omelets', :partial => 'meals/omelet_list',
:locals => {:omelets => @omelet.meals.omelets }
end
end
I understand that Django does not have the same built-in ajax libraries. Does this mean something like the above would be much harder/more verbose in Django?
The "replace_html" calls really make things easy in Rails - I'm hoping there is an easy equivalent in Django.
Also, does Django have the notion of 'partials' - as Rails does?