80927/how-to-remove-all-of-the-data-in-a-table-using-django
How do I delete a table in Django?How do I remove all the data in the table?
This is my code, which is not successful:
Reporter.objects.delete()
Hello @kartik,
Inside a manager:
def delete_everything(self): Reporter.objects.all().delete() def drop_table(self): cursor = connection.cursor() table_name = self.model._meta.db_table sql = "DROP TABLE %s;" % (table_name, ) cursor.execute(sql)
Hope it helps!! Thank You!!
Hey. You can use requests and beautifulsoup ...READ MORE
Hi, it is pretty simple, to be ...READ MORE
Hi@akhtar, In Python, you can use the os. remove() method to remove ...READ MORE
for word in read: <--- iterating ...READ MORE
Hi, there is only that way and ...READ MORE
Hi all, with regard to the above ...READ MORE
Hello @kartik, To turn off foreign key constraint ...READ MORE
Hello @kartik, Let's say you have this important ...READ MORE
Hello @kartik, would suggest using glob.iglob() instead of the glob.glob(), as ...READ MORE
Hi, num_words_list = len(original_str.split()) original_str.split() - split words in ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.