Ops, you are right, LazyForeignKey is quite new and is not available on
pypi yet.
Just specify the relation secondary with a lambda and declare user_sample_table
after Sample and replace the LazyForeignKey with a ForeignKey(Sample.uid).
Like:
from tgext.pluggable import app_model
class Sample(DeclarativeBase):
__tablename__ = 'plutest1_samples'
uid = Column(Integer, autoincrement=True, primary_key=True)
name = Column(Unicode(16))
user = relation(lambda: app_model.User, secondary=lambda:
user_sample_table)
user_sample_table = Table('tg_user_sample', app_model.metadata,
Column('user_id', Integer, ForeignKey(app_model.User.user_id),
primary_key=True),
Column('sample_id', Integer, ForeignKey(Sample.uid), primary_key=True)
)
On Thu, Apr 18, 2013 at 10:40 AM, Luca Verardi <[email protected]>wrote:
> tgext.pluggable = 0.1.3
> https://pypi.python.org/pypi/tgext.pluggable/0.1.3
>
> Traceback (most recent call last):
> File
> "/home/luca/test/trunk/eggs/tgext.pluggable-0.1.3-py2.7.egg/tgext/pluggable/plug.py",
> line 57, in plug
> self._plug_application(self.app_config, self.module_name, self.options)
> File
> "/home/luca/test/trunk/eggs/tgext.pluggable-0.1.3-py2.7.egg/tgext/pluggable/plug.py",
> line 64, in _plug_application
> -1)
> File "/home/luca/test/trunk/test/test1/test1/model/__init__.py", line
> 11, in <module>
> from models import Article, Tag
> File "/home/luca/test/trunk/test/test1/test1/model/models.py", line 7,
> in <module>
>
> from tgext.pluggable import app_model, primary_key, LazyForeignKey
> ImportError: cannot import name LazyForeignKey
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" 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/turbogears?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.