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)
12 if request.method == 'POST':
13 req_items = request.POST
14 elif request.method == 'GET':
15 #return error('only post request is supported')
16 req_items = request.GET
18 for el in req_items.items():
19 if el[0].startswith('filters'):
20 o.filters[el[0][8:-1]] = el[1]
21 elif el[0].startswith('options'):
22 o.options = req_items.getlist('options[]')
28 return success('record deleted')
30 return error('an error has occurred')