Over the past week I’ve been working on adding the ability to send tweets from my new website. Specifically, I want the option to tweet all or some of my content when I publish.
I still have some wrinkles to work out and questions to answer, like: how should I handle hashtags? what about tagging other Twitter users? But it’s working!
In my Admin, I have a checkbox Syndicate to twitter
. If that’s checked and the post is published and I haven’t already tweeted the article, the site updates my Twitter status with content from the post and a link. Also, if I uncheck the box, the site deletes the tweet.
In Django, I set up a new App, Syndications
, to handle the logic with interacting with Twitter (and any other site I end up posting to from my website).
In my Posts
App, I added a TwitterSyndication
model to handle the Twitter data associated with a Post, and added a few properties and methods to the Post
model for handling the update status/delete tweet logic when saving.
I’m still unclear when I should and should not create new Apps in Django. I feel like a new concern is a new App, but I'm ending up with a lot of Apps. I’m sure much of this will become clearer as I continue to work with the framework.