1 from unfold.loginrequired import LoginRequiredView
3 from string import join
5 from rest import ObjectRequest, error, success
8 def dispatch(request, object_type, object_name):
10 o = objectRequest(request, object_type, object_name)
16 if request.method == 'POST':
17 req_items = request.POST
18 elif request.method == 'GET':
19 #return error('only post request is supported')
20 req_items = request.GET
22 for el in req_items.items():
23 if el[0].startswith('filters'):
24 o.filters[el[0][8:-1]] = el[1]
25 elif el[0].startswith('options'):
26 o.options = req_items.getlist('options[]')
29 response = o.execute()
32 return success('record deleted')
34 return error('an error has occurred')