Django error creating new contenttypes when running tests -


i noticed when running tests, output following, , stop test:

"error creating new content types. please make sure contenttypes " runtimeerror: error creating new content types. please make sure contenttypes migrated before trying migrate apps individually. 

i have model field restricted 2 choices of contenttypes, let's type , b.

    content_types = (         contenttype.objects.get_for_model(a).id,         contenttype.objects.get_for_model(b).id,     )      content_type = models.foreignkey(contenttype, null=true, on_delete=models.cascade, limit_choices_to={'id__in': content_types}) 

however, won't able run tests, seems block it. there way not evaluate these contenttypes on startup/when running tests? tried using django.utils.functional.lazy, recommended did not seem work.

content_type = models.foreignkey(contenttype, null=true, on_delete=models.cascade, limit_choices_to=lazy({'id__in': content_types})()) 


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -