django delete database entry old code example

Example 1: delete database entry using name django

obj = get_object_or_404(modelname, name=name)
obj.delete()

Example 2: delete and start fresh with db django

Delete the sqlite database file (often db.sqlite3) in your django project folder (or wherever you placed it)
Delete everything except __init__.py file from migration folder in all django apps
Make changes in your models (models.py).
Run the command python manage.py makemigrations or python3 manage.py makemigrations
Then run the command python manage.py migrate.