Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Add FireO support #1002

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ADR-007
Copy link

@ADR-007 ADR-007 commented Mar 3, 2023

Add supporting for FireO (ORM for Firestore)

Example:

from fireo import Model
from factory_boy.fireo import FireoAutoFactory, nullable

class Comment(Model):
    text = fields.TextField()

class User(Model):
    name = fields.TextField()
    email = MyCustomEmailField()
    comments = fields.ListField(Comment)

class UserFactory(FireoAutoFactory):
    class Meta:
        model = User
        extra_mapping = {
            MyCustomEmailField: lambda maker, field: nullable(field, factory.Faker('email')),
        }

model = UserFactory.create()
assert model.name
assert model.email # works for custom fields too
assert model.comments[0].text  # works for nested models too

@ADR-007 ADR-007 changed the title Feature/add FireO support Feature/Add FireO support Mar 3, 2023
@ADR-007
Copy link
Author

ADR-007 commented Mar 15, 2023

Hi there!

I already have an updated version of it. Please let me know if we can merge it, so I'll know if I need to update the PR.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant