klen / mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Other
939 stars 96 forks source link

Django object with string imports aren't committed #78

Closed Tyrdall closed 7 years ago

Tyrdall commented 7 years ago

I use the standard setup off your app and we use your app in several projects, but never had this issue.

This works:

from .. import models
self.object = mixer.blend(models.ModelName)
self.assertTrue(models.ModelName.objects.all())

Somehow this doesn't work:

from .. import models
self.object = mixer.blend('app.ModelName')
self.assertTrue(models.ModelName.objects.all())

I wasn't able to find out, why they aren't added to the database. Any ideas? Thanks in advance!

Tyrdall commented 7 years ago

My bad. I had an __init__.py in the root folder, which caused that issue.