These are chat archives for django/django

7th
Apr 2018
Miracle Ayodele
@iammiracle
Apr 07 2018 10:05
Hi guys, I have a blog app and i want to integrate newsletter subscription, so that any time there is a new post, users that subscribe can be notified
Luke-VideoLibre
@LukeVideo
Apr 07 2018 10:14
Great. I guess your gonna start with a Boolean external key... And then a overload function on the blog post save or publish method that sends the mail. @iammiracle
Miracle Ayodele
@iammiracle
Apr 07 2018 10:18
Ok, @LukeVideo I was thinking, i need a model to get subscribers first then once the post is created or published, tho the post are scraped data, but once saved, it will send the newly saved post to the subscribers
I'm on track right???
Luke-VideoLibre
@LukeVideo
Apr 07 2018 10:40
Yeah I assumed you already had a user/subscriber model. Yeah take a look at generic views I guess you'll find most of what you need to create that subscriber model. If you want it to also be a user take a look at the simpleisbetterthancomex blog there is an excellent article on that use case. You LL have to search tho it's not one of the latest articles.
It seems right. Also look a how you can override your save function to include the sending of the newsletter. Also be sure to also keep track of it has already been saved as if you edit it you don't want to send it on each edit
Miracle Ayodele
@iammiracle
Apr 07 2018 10:47
Okay @LukeVideo .. Thanks.