Django post_save and south migrations

I have a post_save signal for all objects (not just my application), and in it I create a SignalInfo object (this model from my application), put information about the created / edited object in it and save It. It worked fine until I started using southern migrations.

The problem is that when I do syncdb now, tables for my application are not created (they will be after ./manage.py migrate ), but during syncdb new objects are created, such as auth.permission , and my signal is trying to create an object SignalInfo , but this is not possible, because the tables for my application are not ready, and I have a DatabaseError.

How can I make it work?

+4
source share
1 answer

You can wrap your SignalInfo creation SignalInfo in a try...except block so that the error does not interfere. The only side effect would be that the original models created by syncdb would not have SignalInfo objects associated with them.

+1
source

Source: https://habr.com/ru/post/1395760/


All Articles