Are you sure? I just tested it (using the definitions from the
"Simplifying Association Objects" section) with the following at the
bottom:
if __name__ == '__main__':
user = User('log')
user.keywords = [Keyword('one'), Keyword('two')]
for uk in user.user_keywords:
print uk, uk.
Yes.
However doing so:
user.keywords = [ Keyword('one'), Keyword('two') ]
...will create UserKeywords with user unset. This is the problem.
Dne čtvrtek 5. března 2015 15:11:20 UTC+1 Simon King napsal(a):
>
> I haven't looked at your code closely so I'm not sure what the problem
> is, but I'm n
I haven't looked at your code closely so I'm not sure what the problem
is, but I'm not sure your creator factory should be necessary. The
association proxy docs say that something like:
kw = Keyword('one')
user.keywords.append(kw)
has the same effect as:
kw = Keyword('one')
uk =
Hi,
I just noticed that User.groups relationship is not needed at all (it was a
relict of previous setup before System column was added).
So the problem is completely gone.
---
I already use *AssociationProxy* pattern in order to have relations like
*User.A_groups,
User.B_group**s, USer.C_gr
Glad you've figured it out. This is touched on briefly in the docs, in
the note at the bottom of:
http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#association-object
As an alternative to making User.groups a relationship, you could also
consider using the Association Proxy exten
Hi,
Adding viewonly=True on User.groups relationship solved the issue.
cheers!
Dne čtvrtek 5. března 2015 11:26:58 UTC+1 Pavel S napsal(a):
>
> Hello,
>
> I have relation User-User2Group-Group with additional attribute System on
> User2Group table.
> The System is part of primary key, which means