I have the following simple view. Is there any way I can make it more dynamic?
# ...
if 'folding' not in request.session:
request.session['folding'] = {'shop':False,'users':False,'chat':False}
# ...
def update_folding_view(request,category,is_folded):
if request.is_ajax():
folding = request.session['folding']
if 'shop' in category:
folding.shop = is_folded
if 'users' in category:
folding.users = is_folded
if 'chat' in category:
folding.chat = is_folded
request.session['folding'] = folding
else:
raise Http404
This is what I got: