Exemplo n.º 1
0
def index_view(request):
    userinfo = TwitterUser.objects.get(id=request.user.id)
    followed_count = userinfo.followed.all().count()
    tweets = get_tweets(userinfo)
    count_tweet = user_tweets(userinfo)
    count_notify = count_notification(userinfo)
    return render(request, "index.html", {
        "title": "Twitter Clone",
        "userinfo": userinfo,
        "followed_count": followed_count,
        "tweets": tweets,
        "tweet_count": count_tweet,
        "notif_count": count_notify,
        "template_name": "tweets.html"
    })
Exemplo n.º 2
0
def notification_view(request, user_username):
    userinfo = TwitterUser.objects.get(username=user_username)
    followed_count = userinfo.followed.all().count()
    tweets = get_user_tweets(userinfo)
    count_tweet = user_tweets(userinfo)
    notif = get_notification(userinfo)
    delete_notification(userinfo)
    count_notify = count_notification(userinfo)
    return render(request, "index.html", {
        "title": "Twitter Clone",
        "userinfo": userinfo,
        "followed_count": followed_count,
        "tweets": tweets,
        "tweet_count": count_tweet,
        "notif_count": count_notify,
        "notifications": notif,
        "template_name": "notifications.html"
    })