소스 검색

remove all previously added staff while new file been uploaded

Mohidul Islam 4 년 전
부모
커밋
42f04845f6
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      manager/views.py

+ 3 - 0
manager/views.py

@@ -48,6 +48,9 @@ class LocationListView(View, PermissionRequiredMixin):
                 messages.warning(request, "Columns in missing. Check columns ['Name', 'Location', 'Job Title'] again.")
                 return redirect('location-list')
 
+            # Clear all previously registered staffs
+            staffs = Staff.objects.all()
+            staffs.delete()
             for row in rows:
                 try:
                     name, loc, dept = row[name_idx], row[loc_idx], row[dept_idx]