Hello.
>From the little example below, it seems that setting save_on_init=False on
a class is ignored
when that class is pointed to by a relationship from another object which
IS saved (or selected
from the database, for that matter).
Is this intended behaviour?
See the example below. If you comment out the "addresses" relationship on
AddressBook (see #1),
it works as intuitively expected.
#----------[example START]----------------------------
import elixir
elixir.metadata.bind = 'sqlite://'
class AddressBook(elixir.Entity):
addresses = elixir.OneToMany(u'Address') #1
pass
class Address(elixir.Entity):
elixir.using_mapper_options(save_on_init=False)
address_book = elixir.ManyToOne(u'AddressBook')
elixir.setup_all()
elixir.create_all()
book = AddressBook()
new_address = Address(address_book=book)
assert not Address.query.all() # breaks here
#----------[example END]----------------------------
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlelixir?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.