How to use django-subscription to create live notifications
Asked Answered
S

1

0

I have been working on this for some time now, and would like to create facebook-like notification system. My project has following features

  • It has a blog interface where users can write their blogs, and people can post comments on it. I want to send notification to the author whenever somebody comments on it.

  • Users can post their questions, just like on stackoverflow and whenever somebody answers the question I want to inform the user which posted it.

  • Users can mark certain blogs/questions as favorites and whenever any activity happen on them then I want the respective user to be notified.

I after searching a lot I found a post saying that django-subscription can provide the best solution for it, however after reading the docs I have come to a dead end. I developing on windows, and when I tried to run the test, there was a failure.

Also the docs are very unclear and I am not getting how things will work. Can anybody point me in the right direction.

Sidney answered 22/12, 2011 at 11:5 Comment(8)
I'll rewrite subsume's READ into a proper documentation later tonight. Thanks for your feedback both about this and the issue on github.Narghile
I am really looking forward to an updated documentation because I need to make this thing and django-subscription will really help. Just to give you a beginner's perspective one thing that I generally find missing in the docs is that there is no example of how I can use the app to see it working in one of my templates. So if you can add that, it would help immenselySidney
As i said in the other post, being "notified" "like facebook" is quite a complicated question which takes a lot of study of facebook, django and django apps. If django-subscription is able to send email notifications (bare, or yourlabs with some work), it doesn't provide the user with a page that allows him to check/uncheck the types of notifications he wants to receive or not. I'm currently working on our repo but if you prefer, it might be better that i write an exhaustive blog post about this apps, so that you can know better where to invest your time. What do you think ?Narghile
I will really appreciate if you can guide me to the right direction. I have made a lot of stuff but with this notification stuff I am totally stuck. If it makes simpler I dont really have to give the user to select or unselect the kind of notifications he/she receives. Also I dont want to send emails, rather I want to set that info in some view, where I can displaySidney
I'd love to move this discussion to chat with you but i have no idea how to do that. Anyway, you can play with the sample project which i have just refreshed until i write the documentation (sorry, big headhache right now!). Take a look at the README: github.com/yourlabs/django-subscription/tree/master/…Narghile
No problem I will work around the sample project to see what I can make of it... Meanwhile will also be waiting for your updated documentation. Do let me know if I can help you in writing the documentationSidney
See my recent activity on github (github.com/jpic) and eventually follow me to see how it goes. It did some documentation this morning. There is an open issue about documentation (note that issues are tracked on subsume/django-subscription). All help is welcome.Narghile
let us continue this discussion in chatNarghile
C
0

You do it better via signals. If somethings happens, creating send email to subscribers.

@receiver(post_save, sender=BlogPost)
def send_mail_to_subs(sender, instance, created, **kwargs):
    if created:
        for subs in instance.author.subscribed.all():
            send_mail(
                f'New Post from {instance.author}',
                f'Title: {instance.post_title}',
                'youremail',
                [subs.email],
            )

Good coding :)

Cool answered 15/12, 2021 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.