Пример #1
0
 def checking(*args, **kwargs):
     api_key = args[0].values.get('api_key', False)
     if not api_key:
         return Response(status=401)
     customer = ApiCustomer.all().filter('api_key =', api_key).get()
     if not customer or not customer.is_writer:
         return Response(status=401)
     return func(*args, **kwargs)
Пример #2
0
def api_view_key(request, key_key):
    customer = ApiCustomer.get(key_key)
    return render_to_response('admin/api/view_key.html', {'customer':customer})
Пример #3
0
def api_delete_key(request, key_key):
    customer = ApiCustomer.get(key_key)
    if customer:
        customer.delete()
    return redirect('admin/api/')
Пример #4
0
def api_index(request):
    customers = ApiCustomer.all()
    return render_to_response('admin/api/index.html', {'customers':customers})