Git Product home page Git Product logo

Comments (3)

jorilallo avatar jorilallo commented on June 14, 2024

Here's a patch that I used:

From 19cd6026e433b65401cbb8843124a03f65d36db1 Mon Sep 17 00:00:00 2001
From: Jori [email protected]
Date: Tue, 18 May 2010 11:29:38 +0300
Subject: [PATCH] Added next attribute to support non-AJAX (un)follow requests


actstream/views.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/actstream/views.py b/actstream/views.py
index dbe9139..8c2a5ca 100644
--- a/actstream/views.py
+++ b/actstream/views.py
@@ -12,6 +12,8 @@ def follow_unfollow(request, content_type_id, object_id, follow=True):
"""
Creates follow relationship st request.user starts following the actor defined by content_type_id, object_id
"""

  • next = request.GET.get('next', False)

  • ctype = get_object_or_404(ContentType, pk=content_type_id)
    actor = get_object_or_404(ctype.model_class(), pk=object_id)
    lookup = {
    @@ -21,9 +23,15 @@ def follow_unfollow(request, content_type_id, object_id, follow=True):
    }
    if follow:
    Follow.objects.get_or_create(**lookup)

  •    return type('Created', (HttpResponse,), {'status_code':201})()
    
  •    if next:
    
  •        return HttpResponseRedirect(next)
    
  •    else:
    
  •        return type('Created', (HttpResponse,), {'status_code':201})()
    

    Follow.objects.get(**lookup).delete()

  • return type('Deleted', (HttpResponse,), {'status_code':204})()

  • if next:

  •   return HttpResponseRedirect(next)
    
  • else:

  •    return type('Deleted', (HttpResponse,), {'status_code':204})()
    

    @login_required

    def stream(request):

    1.6.4.2+GitX

from django-activity-stream.

justquick avatar justquick commented on June 14, 2024

OK I fixed up some stuff in the most recent revision and it should now redirect if the 'next' paramater is anywhere in the request. The other code is in there provides responses in the 200 range which hopefully will be usefull for ajax but i dont know. Anyway it redirects now. Next time instead of pasting your patches in the comment which seems to have failed miserably, just fork the project and send a pull request.

from django-activity-stream.

jorilallo avatar jorilallo commented on June 14, 2024

Yeah, sorry about that. I'm still new to git and forking.

from django-activity-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.