berinhard / model_mommy

No longer maintained, please migrate to model_bakery
http://model-bakery.readthedocs.org/
Other
903 stars 141 forks source link

Recipes broken on 1.2.1 version #165

Closed pablorecio closed 10 years ago

pablorecio commented 10 years ago

Having this:

    my_recipe = Recipe('app.Model',
        name=seq('Foo'),
        slug=seq('foo'),
    )
    my_recipe.make(_quantity=5)

Breaks with the last version giving the following trace:

Traceback (most recent call last):
  File "/somewhere/tests.py", line 1, in test_things
    my_recipe.make(_quantity=5)
  File "/somewhere/model_mommy/recipe.py", line 43, in make
    return mommy.make(self.model, **self._mapping(attrs))
  File "/somewhere/model_mommy/recipe.py", line 26, in _mapping
    if self.model.objects.count() == 0:
AttributeError: 'str' object has no attribute 'objects'

It does work fine on 1.2

berinhard commented 10 years ago

Thanks @pyriku for the report!

vandersonmota commented 10 years ago

fixed: 009f70a