Comments (3)
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.
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.
Yeah, sorry about that. I'm still new to git and forking.
from django-activity-stream.
Related Issues (20)
- Verb examples do not match spec
- django 4.0 support HOT 5
- django-activity-stream and django-comments-xtd HOT 2
- Activity Stream 2 JSON Feeds HOT 2
- AS2 paging
- DRF support HOT 3
- Use pluggy for customization report
- Installation breaks with pip -r HOT 2
- Django -activity stream HOT 1
- Missing migration when moving from Django 2.2 to 3.2 HOT 1
- Not working with Django 4.1 HOT 9
- Release new version HOT 1
- Filter user feed with distinct('action_object') HOT 1
- [Feature proposal] Delete Follow objects when the followed object is deleted? HOT 1
- Remove usage of `datetime_safe` HOT 4
- Field 'actor' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation. HOT 4
- [Feature request ] Soft delete for action
- Registering models from third-party apps HOT 1
- Make a 2.0 release and publish to PyPI HOT 4
- Add multidatabase support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-activity-stream.