Posts Tagged ‘manage.py’

How to reset all table contents in django database using view.py or controller?

Sometimes we need to delete or truncate all the database tables in django project from the view.py or controller file. First of all you need to go to open the view.py and add the following code to your some functions: Modelname.objects.all().delete() Here, the Modelname is your django model Class name in Models.py. Then run the application and make sure that the control reach the line where you added the ... Full story
Copyright © 2024 Programmer to Programmer- A website for web programming and mobile application programming tutorials.
Wordpress themes