title: My Own Like Button: Django + Ajax -- How?
body: <p>So I've been having trouble turning this view into an Ajax call:</p>
  
  <pre><code>def company_single(request, slug):
      company = get_object_or_404(CompanyProfile, slug=slug)
      company_list = CompanyProfile.objects.get(slug=slug)
  
      try:
          tcompany = CompanyLikes.objects.get(company=company_list)
          total_likes = tcompany.likes
          user_liked = CompanyLikes.objects.get(user=request.user)
      except:
          total_likes = 0
  
  
      instance, created = CompanyLikes.objects.get_or_create(company=company_list)
      likes_form = CompanyLikesForm(request.POST or None, instance=instance)
  
      if likes_form.is_valid():
          this = likes_form.save(commit=False)
          try:    
              if user_liked:
                  this.likes -=1
                  this.user.remove(request.user)
          except:
              this.user.add(request.user)
              this.likes += 1
          this.save()
  
      return render_to_response('company.html', locals(), context_instance=RequestContext(request))
  </code></pre>
  
  <p>I think I need jQuery and JSON, but I'm not sure how to implement it here to make my own "like button" for my site. Any thoughts/suggestions?</p>