How can i create a new sql model that is tied to the username field in
the identity tables.
So I have setup users using catwalk and identity. All default setting
no modifications to any file other then dev.cfg.
I need to have another database table that can link users to posting
codes.
so a user can have many posting codes.
Sorry for the newbie question. I thought this would work...
#class purch_user(SQLObject):
# postcode = StringCol(length=10)
# user = RelatedJoin(User)
a RelatedJoin means more then what you want I believe a ForeingKey is all you need sayin each purch_user is related to one user
#class purch_user(SQLObject):
# postcode = StringCol(length=10)
# user = ForeignKey(User)
I recomment you go over the SQLObject docs at their site is very small yet great to start with.
put it gives me an error when create the tables tg-admin sql create...
[EMAIL PROTECTED]:~/sandbox/turbogears/intranet$ tg-admin sql create
Using database URI mysql://[EMAIL PROTECTED]/intranet
Traceback (most recent call last):
File "/usr/local/bin/tg-admin", line 7, in ?
sys.exit(
File
"/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py",
line 275, in main
command.run ()
File
"/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/command/base.py",
line 134, in run
command.the_runner.run(sys.argv)
File
"/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
line 102, in run
runner.run()
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
line 233, in run
self.command()
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
line 542, in command
for soClass in self.classes (require_some=True):
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
line 245, in classes
all.extend(self.classes_from_egg(egg_spec))
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/manager/command.py",
line 410, in classes_from_egg
modules.extend(self.classes_from_module(
File
"/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1457-py2.4.egg/sqlobject/util/moduleloader.py",
line 5, in load_module
mod = __import__(module_name)
File "/home/pkraus/sandbox/turbogears/intranet/intranet/model.py",
line 97, in ?
class purch_user(SQLObject):
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/declarative.py",
line 94, in __new__
cls.__classinit__(cls, new_attrs)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/main.py",
line 777, in __classinit__
cls.sqlmeta.addJoin(j)
File
"/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1457-py2.4.egg/sqlobject/main.py",
line 478, in addJoin
join = joinDef.withClass(soClass)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/joins.py",
line 41, in withClass
joinMethodName=self._joinMethodName,
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/joins.py",
line 163, in __init__
SOMultipleJoin.__init__(self, **kw)
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/joins.py",
line 123, in __init__
self.addRemoveName = capitalize(self.otherClassName)
File
"/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1457-py2.4.egg/sqlobject/joins.py",
line 243, in capitalize
return name[0].capitalize() + name[1:]
TypeError: Error when calling the metaclass bases
unindexable object
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

