示例#1
0
文件: case.py 项目: mr-bin/oni_kuryat
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)
示例#2
0
文件: case.py 项目: mr-bin/oni_kuryat
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)
示例#3
0
文件: case.py 项目: mr-bin/oni_kuryat
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)
示例#4
0
文件: case.py 项目: mr-bin/oni_kuryat
def remove(request, id = 0):
    ui = case_ui(request) 
    ui.remove(id)
    return redirect('/cases/')