Exemple #1
0
def loyalty(tourist_id):
    try:
        tourist = Tourist.objects.get(id=tourist_id)
    except Tourist.DoesNotExist:
        return Http404
    time_now = datetime.now().date().year * 365 + datetime.now().date().month * 30 + datetime.now().date().day
    time_joined = tourist.date_joined.year * 365 + tourist.date_joined.month * 30 + tourist.date_joined.day
    # print("\ntime joining   " + str(time_now - time_joined) + "\n")
    return time_now - time_joined + tourist_comments_count(tourist_id) * 100 + tourist_services_price(tourist_id)
Exemple #2
0
def reprot_view(request):
    if request.method == 'GET':
        tourist = request.user.site_user.tourist
        if tourist:
            context = {
                'service_bought': tourist_services_count(tourist.id),
                'servic_used': tourist_services_used_count(tourist.id),
                'servic_waited': tourist_services_waited_count(tourist.id),
                'hotel_bought': tourist_rooms_count(tourist.id),
                'flight_bought': tourist_flights_count(tourist.id),
                'tour_bought': tourist_tours_count(tourist.id),
                'all_price' : tourist_services_price(tourist.id),
                'comment_count' : tourist_comments_count(tourist.id),
            }
            return render(request, 'tourist/report.html', context)
        return HttpResponse("You don't have permition to this page")