예제 #1
0
파일: views.py 프로젝트: aldeka/shortcake
def shurl_stats(request,short_suffix):
    '''Returns how many times a given short URL has been accessed -- human readable'''
    n = convert_from_base_64(short_suffix)
    shurl = get_object_or_404(Shurl,pk=n)
    return HttpResponse('URL ' + short_suffix + ' has been accessed ' + str(shurl.access_count) + ' time(s).')
예제 #2
0
파일: views.py 프로젝트: aldeka/shortcake
def shurl_accesses(request,short_suffix):
    '''Returns how many times a given short URL has been accessed'''
    n = convert_from_base_64(short_suffix)
    shurl = get_object_or_404(Shurl,pk=n)
    return HttpResponse(str(shurl.access_count))
예제 #3
0
파일: views.py 프로젝트: aldeka/shortcake
def forward(request,short_suffix):
    '''Given the suffix of a short url, forwards us on to that short url's real url'''
    n = convert_from_base_64(short_suffix)
    shurl = get_object_or_404(Shurl,pk=n)
    # get_url() updates the appropriate access_counts and returns the url
    return redirect(shurl.get_url())