def next_scheduled(request): from django.template import Context from django.template.loader import get_template tweet = ScheduledTweet.untweeted(request.user, descending=False).get() if tweet: template = get_template("_next_scheduled_tweet.html") content = template.render(Context({"tweet": tweet})) return JsonResponse({"content": content}) else: # HTTP status code must currently be 200 -- otherwise, jQuery's getJSON # won't execute my callback, thereby preventing me from handling the error. return JsonResponse({"error_code": "no_tweets_scheduled", "error_text": "No Tweets scheduled."})
def view(request): tweets = ScheduledTweet.untweeted(request.user) return direct_to_template(request, "view_tweets.html", {"tweets": tweets})