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 index_view(request):
    user_info=TwitterUser.objects.get(id=request.user.id)
    followed_count = user_info.followed.all().count()
    tweets = get_tweets(user_info)
    count_tweet = user_tweets(user_info)
    count_notify = count_notifications(user_info)
    
    return render(request, 'index.html', {
        'user_info': user_info,
        'followed_count': followed_count,
        'tweets': tweets,
        'tweet_count': count_tweet, 
        'notif_count': count_notify,
        'template_name': 'tweets.html'
    })
Exemplo n.º 3
0
def notification_view(request, user_username):
    user_info=TwitterUser.objects.get(username=user_username)
    followed_count = user_info.followed.all().count()
    tweets = get_user_tweets(user_info)
    count_tweet = user_tweets(user_info)
    get_notified = get_notifications(user_info)
    count_notify = count_notifications(user_info)
    return render(request, 'index.html', {
        'user_info': user_info,
        'followed_count': followed_count,
        'tweets': tweets,
        'tweet_count': count_tweet, 
        'notifications': get_notified,
        'notif_count': count_notify,
        'template_name': 'notifications.html'
    })
Exemplo n.º 4
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"
    })