update sanitize_usde_schools.py to not require confirmation for sanitization 299/head
authorJacob Hilker <hilker.j@gmail.com>
Thu, 23 Jan 2014 00:45:49 +0000 (19:45 -0500)
committerJacob Hilker <hilker.j@gmail.com>
Thu, 23 Jan 2014 00:45:49 +0000 (19:45 -0500)
karmaworld/apps/courses/management/commands/sanitize_usde_schools.py

index 119e42022e0c5eca7196b25ead3194693681d299..c75a410644fd5f68e9e25dc32c06aaff46bed4b5 100644 (file)
@@ -64,23 +64,17 @@ class Command(BaseCommand):
             self.stdout.write('There are no schools worth sanitizing.\n')
             return False
 
-        self.stdout.write(u"\n\nWARNING: Are you sure you want to delete these schools:\n")
-        for s in schools:
-            self.stdout.write('%s: %s' % (s.id, s.__unicode__()))
-            self.stdout.write('\n')
-
-        if self.get_input("Do you want to delete these schools? [y/n]  "):
+        self.stdout.write("...")
+        try:
+            schools.delete()
+        except:
+            self.stdout.write("that is too many to delete at once\n")
+            self.stdout.write("you are probabily using sqlite , doing them in batches\n")
+            for _i, a_school in enumerate(schools):
+                self.stdout.write("deleting %s of %s..." % (_i, self._schools_count))
+                a_school.delete()
+                self.stdout.write("done\n")
             self.stdout.write("...")
-            try:
-                schools.delete()
-            except:
-                self.stdout.write("that is too many to delete at once\n")
-                self.stdout.write("you are probabily using sqlite , doing them in batches\n")
-                for _i, a_school in enumerate(schools):
-                    self.stdout.write("deleting %s of %s..." % (_i, self._schools_count))
-                    a_school.delete()
-                    self.stdout.write("done\n")
-                self.stdout.write("...")
 
-            self.stdout.write("all done!\n")
-            self.stdout.write("Deleted %s schools" % (self._schools_count))
+        self.stdout.write("all done!\n")
+        self.stdout.write("Deleted %s schools" % (self._schools_count))