def cases(request): response_context = { 'title': 'Cases', 'login_form': LoginForm(), 'is_auth': False, 'active': 'case', } if request.user.is_authenticated(): response_context['is_auth'] = request.user.is_authenticated() response_context['username'] = request.user.username if request.user.is_staff: response_context['mode'] = 'admin' ui = case_ui(request) genui = generic_ui(request) response_context['city'] = genui.brand() response_context['cases'] = ui.cases() return direct_to_template(request, 'ui/case/cases_page.html', response_context)
def edit(request, id=0): response_context = { 'title': 'Buses', 'login_form': LoginForm(), 'is_auth': False, 'active': 'bus', 'bus_id': id } if request.user.is_authenticated(): response_context['is_auth'] = request.user.is_authenticated() response_context['username'] = request.user.username if request.user.is_staff: response_context['mode'] = 'admin' ui = case_ui(request) genui = generic_ui(request) response_context['city'] = genui.brand() response_context['form'] = ui.edit(id) return direct_to_template(request, 'ui/bus/bus_edit.html', response_context)
def add(request): response_context = { 'title': 'Cases', 'login_form': LoginForm(), 'is_auth': False, 'active': 'case', 'params': '\"case\"', } if request.user.is_authenticated(): response_context['is_auth'] = request.user.is_authenticated() response_context['username'] = request.user.username if request.user.is_staff: response_context['mode'] = 'admin' ui = case_ui(request) genui = generic_ui(request) response_context['city'] = genui.brand() response_context['form'] = ui.add() if request.method == 'POST': return redirect('/cases/') else: return direct_to_template(request, 'ui/case/case_page.html', response_context)
def remove(request, id = 0): ui = case_ui(request) ui.remove(id) return redirect('/cases/')