@require_role('admin')
def idc_add(request):
 (header_title, path1, path2) = (u'\u6dfb\u52a0IDC', u'\u8d44\u4ea7\u7ba1\u7406', u'\u6dfb\u52a0IDC')
 if (request.method == 'POST'):
  idc_form = IdcForm(request.POST)
  if idc_form.is_valid():
   idc_name = idc_form.cleaned_data['name']
   if IDC.objects.filter(name=idc_name):
    emg = (u'\u6dfb\u52a0\u5931\u8d25, \u6b64IDC %s \u5df2\u5b58\u5728!' % idc_name)
    return my_render('jasset/idc_add.html', locals(), request)
   else:
    idc_form.save()
    smg = (u'IDC: %s\u6dfb\u52a0\u6210\u529f' % idc_name)
   return HttpResponseRedirect(reverse('idc_list'))
 else:
  idc_form = IdcForm()
 return my_render('jasset/idc_add.html', locals(), request)

@ require_role ( 'admin' ) def idc_add ( request ) : ( header_title , path1 , path2 ) = ( u'\u6dfb\u52a0IDC' , u'\u8d44\u4ea7\u7ba1\u7406' , u'\u6dfb\u52a0IDC' ) if ( request . method == 'POST' ) : idc_form = IdcForm ( request . POST ) if idc_form . is_valid ( ) : idc_name = idc_form . cleaned_data [ 'name' ] if IDC . objects . filter ( name = idc_name ) : emg = ( u'\u6dfb\u52a0\u5931\u8d25, \u6b64IDC %s \u5df2\u5b58\u5728!' % idc_name ) return my_render ( 'jasset/idc_add.html' , locals ( ) , request ) else : idc_form . save ( ) smg = ( u'IDC: %s\u6dfb\u52a0\u6210\u529f' % idc_name ) return HttpResponseRedirect ( reverse ( 'idc_list' ) ) else : idc_form = IdcForm ( ) return my_render ( 'jasset/idc_add.html' , locals ( ) , request )
idc add view .