Ejemplo n.º 1
0
def changepassword(request):
    context = {
        'token': 'Change your password',
        'image': request.user.profile.profile_picture,
        'searchform': SearchForm(),
    }
    return render(request, 'html/changepassword.html', context)
Ejemplo n.º 2
0
def rated(request):
    context = {
        'token': 'rated',
        'searchform': SearchForm(),
    }
    with connection.cursor() as cur:
        query = "Select  movie_show.Title,movie_show.ReleaseDate,movie_show.Duration,movie_show.Description,movie_show.Image,movie_show.Avg_rating,movie_show.Num_rating,movie_rating.Stars from movie_show,movie_rating" \
                " where movie_show.id=movie_rating.Show_id and User_id = {}"
        print(request.user.id)
        query = query.format(request.user.id)
        cur.execute(query)
        context['data'] = cur.fetchall()
        print(context['data'])
    return render(request, 'html/rated.html', context)
Ejemplo n.º 3
0
def celeb(request, filter):
    with connection.cursor() as cur:
        query_celebrities = "SELECT DISTINCT * " \
                            "FROM Celebrities_celebrity"
        cur.execute(query_celebrities)
        celebrities = cur.fetchall()
        count = len(celebrities)
        context = {
            "count": count,
            "celebs": celebrities,
            'searchform': SearchForm(),
        }
        print(celebrities)
        return render(request, 'html/cleblist.html', context)
Ejemplo n.º 4
0
def watchlist(request):
    context = {
        'token': 'watchlist',
        'image': request.user.profile.profile_picture,
        'searchform': SearchForm(),
    }
    with connection.cursor() as cur:
        query = "Select * from movie_show " \
                " where id in " \
                " (Select Show_id from movie_favourite where Type='W' " \
                "And User_id = {})"
        query = query.format(request.user.id)
        cur.execute(query)
        context['data'] = cur.fetchall()
    return render(request, 'html/watchfavlist.html', context)
Ejemplo n.º 5
0
def single_celeb(request, celeb_id):
    with connection.cursor() as cur:
        query_celebrities = f"SELECT * " \
                            f"FROM Celebrities_celebrity" \
                            f" WHERE id={celeb_id}"
        cur.execute(query_celebrities)
        celebrities = cur.fetchall()
        query_key = f"SELECT Tag_Name" \
                    f" FROM Celebrities_Tag" \
                    f" WHERE celeb_id={celeb_id}"
        cur.execute(query_key)
        keywords = cur.fetchall()
        context = {
            "celebs": celebrities,
            "keywords": keywords,
            'searchform': SearchForm(),
        }
        print(celebrities)
        return render(request, 'html/celebritysingle.html', context)
Ejemplo n.º 6
0
def profile(request):
    if request.method == 'POST':
        profileupdateform = UpdateProfile(request.POST,
                                          instance=request.user.profile)
        userform = UserForm(data=request.POST, instance=request.user)
        if profileupdateform.is_valid() and userform.is_valid():
            profileupdateform.save()
            userform.save()
    else:
        profileupdateform = UpdateProfile(instance=request.user.profile)
        userform = UserForm(instance=request.user)
    context = {
        'token': 'profile',
        'image': request.user.profile.profile_picture,
        'searchform': SearchForm(),
        'profileupdateform': profileupdateform,
        'userform': userform,
    }
    print('image', context['image'])
    return render(request, 'html/profile.html', context)