ContentType matching query does not exist on post_syncdb

后端 未结 1 853
悲&欢浪女
悲&欢浪女 2021-01-13 15:46

I am trying to add add some data to the database as soon as tables are created, using the post_syncdb signal.

signals.post_syncdb.connect(init)
         


        
相关标签:
1条回答
  • 2021-01-13 16:10

    Add this to the beginning of your init function:

     from django.contrib.contenttypes.management import update_all_contenttypes
     update_all_contenttypes() # make sure all content types exist
    
    0 讨论(0)
提交回复
热议问题