model-bakers/model_bakery

Using other fields to generate data

knyghty opened this issue · 0 comments

I am wondering if it's possible to generate data for a field using another field. An example from the Factory Boy docs:

class UserFactory(factory.Factory):
    class Meta:
        model = User

    username = 'john'
    email = factory.LazyAttribute(lambda o: '%s@example.com' % o.username)

i am struggling to find a way to do a similar thing. Is this possible?