Skip to content

Using other fields to generate data #472

@knyghty

Description

@knyghty

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions