Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

TestData creating children #165

Closed Jaymon closed 1 year ago

Jaymon commented 1 year ago

Let's say we've got this:

class Foo(Orm): pass

class Bar(Orm):
    foo_id = Field(Foo)

Could I make something like this work:

f = testdata.create_foo(bars_count=2)

for b in f.bars:
    ...

It would basically check the internal Orm list and see if anything matches .models_name and then make sure the match has a reference to Foo and then create however many count specified.