Is it possible to automatically remove obsolete content types in Django?

I am working with a PyQt application that uses Django to deliver content to desktop users.

In the latest update, we have obsolete content types stored in the Django database, and when you start the South migrate or syncdb application, it suggests deleting them. Is there anything you can do with a call to migrate / syncdb that automatically removes them?

This invitation cannot be exposed to the end user for obvious reasons, so I really hope that we can automatically take it :)

I saw that with southward migration you can call --noinput , but that will not delete them, and it would be nice if we could do this, since we know that it will be safe.

+7
django django-south
source share
2 answers

On Unix systems, there is a yes command that will repeatedly output a string to stdout, separated by newline characters. We can use this to automatically respond to this invitation.

yes "yes" | python ./manage.py migrate

+15
source share

I use this command to automatically answer yes in my scripts when I do Django migrations:

 cat <(echo "yes") - | ./manage.py syncdb --migrate 

Please note that this only applies to the first request. You can learn more about how this works and how to add an automatic response to the second invitation:

stack overflow

+1
source share

All Articles