Exemplo n.º 1
0
 def wm_import_stuff(self):
   for staff in Staff.objects.all():
     staff.delete()
   wm_staff_list = WorkflowmaxStaff.objects.all()
   for wm_staff in wm_staff_list:
     staff = Staff()
     staff.wm_import(wm_staff)
Exemplo n.º 2
0
def import_staff(request):
  context_vars = dict()
  context_vars['header'] = capfirst(_('import staff from workflowmax'))
  context_vars['comment'] = capfirst(_('this will destroy all your local staff, please confirm your decision.'))
  if request.method == "POST":
    for staff in Staff.objects.all():
      staff.delete()
    wm_staff_list = WorkflowmaxStaff.objects.all()
    for wm_staff in wm_staff_list:
      staff = Staff()
      staff.wm_import(wm_staff)
    return HttpResponseRedirect(reverse('staff-list'))
  
  return direct_to_template(request, template='staff/import.html', extra_context=context_vars)