title: How to use Django (Class)Views for a particular <div> in the template (through Ajax) ;I am integrating django-chatrooms app in my project
body: <p>I am relatively new to Django . I want to integrate Django-chatrooms(<a href="https://github.com/qubird/django-chatrooms" rel="nofollow">https://github.com/qubird/django-chatrooms</a>) App into my project . 
  This app has 3 different URLs (1.Available-ChatRooms list 2.Set-guestname/Login 3.Room(actual chat interface)) . 
  But I want to make all these 3 features (Join room,set guestname/login and chatWindow)available to the user at the same URL (which is my Project HomePage).So I will be doing it through Ajax .</p>
  
  <p>I need to call 3 Class Views from the App ; This is the corresponding URL's and views files of the app :</p>
  
  <h1>urls.py</h1>
  
  <pre><code>#encoding=utf8
  
  from django.conf.urls.defaults import url, patterns
  
  from . import views
  from .utils.decorators import room_check_access
  from .ajax import chat
  
  urlpatterns = patterns('chatrooms',
      # room views
      url(r'^rooms/$',
      views.RoomsListView.as_view(),
      name="rooms_list"),
      url(r'^room/(?P&lt;slug&gt;[-\w\d]+)/$',
      room_check_access(views.RoomView.as_view()),
      name="room_view"),
      url(r'^setguestname/$',
      views.GuestNameView.as_view(),
      name="set_guestname"),
  
      # ajax requests
      url(r'^get_messages/', chat.ChatView().get_messages),
      url(r'^send_message/', chat.ChatView().send_message),
      url(r'^get_latest_msg_id/', chat.ChatView().get_latest_message_id),
      url(r'^get_users_list/$', chat.ChatView().get_users_list),
      url(r'^notify_users_list/$', chat.ChatView().notify_users_list),
  )
  </code></pre>
  
  <h1>Views.py</h1>
  
  <pre><code>#encoding=utf8
  
  from django.core.urlresolvers import reverse
  from django.http import HttpResponseRedirect
  from django.views.generic import ListView, DetailView, FormView
  
  from .utils.auth import get_login_url
  from .forms.guest import GuestNameForm
  from .models import Room
  
  
  class RoomsListView(ListView):
      """View to show the list of rooms available """
      context_object_name = "rooms"
      template_name = "chatrooms/rooms_list.html"
      paginate_by = 20
  
      def get_queryset(self):
      filters = {}
      if self.request.user.is_anonymous():
          filters['allow_anonymous_access'] = True
      return Room.objects.filter(**filters)
  
  
  class RoomView(DetailView):
      """View for the single room """
      model = Room
      context_object_name = 'room'
      template_name = "chatrooms/room.html"
  
  
  class GuestNameView(FormView):
      """Shows the form to choose a guest name to anonymous users """
      form_class = GuestNameForm
      template_name = 'chatrooms/guestname_form.html'
  
      def get_context_data(self, **kwargs):
      kwargs.update(super(GuestNameView, self).get_context_data(**kwargs))
      room_slug = self.request.GET.get('room_slug')
      next = ''
      if room_slug:
          next = reverse('room_view', kwargs={'slug': room_slug})
      kwargs['login_url'] = get_login_url(next)
      return kwargs
  
      def get_initial(self):
      init = super(GuestNameView, self).get_initial()
      room_slug = self.request.GET.get('room_slug')
      if room_slug:
          init.update(room_slug=room_slug)
      return init
  
      def form_valid(self, form):
      guest_name = form.cleaned_data.get('guest_name')
      room_slug = form.cleaned_data.get('room_slug')
      self.request.session['guest_name'] = guest_name
      if room_slug:
          redirect_url = reverse('room_view', kwargs={'slug': room_slug})
      else:
          redirect_url = reverse('rooms_list')
      return HttpResponseRedirect(redirect_url)
  </code></pre>
  
  <h1>My Home View containing home.html template (where I want to integrate Chat)</h1>
  
  <pre><code>def home_view(request):
      site = Site.objects.get_current()
      return render_to_response('home.html', {'user':request.user,'data':request.POST , 'site':site})
  </code></pre>
  
  <h2>How do I receive a template with it's context and append it to my div as an HTML ? (For eg . I want that whenever I call GuestNameView through Ajax, it should return me a template with the context rendered which I will append as HTML to my div at project home )</h2>