示例#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())