If usercode is unique:

class UserCode(SQLObject):
    usercode = StringCol(length=3, alternateID=True)

Then:

u = UserCode.byUsercode('007')
n = u.name

should work.

On Nov 10, 3:46 pm, jasper_coder <[EMAIL PROTECTED]> wrote:
> Preparing to toss the old machine through the window... and everything
> was going so well ;o) and, in fact with the other Classes I've
> declared in the model, it is working smoothly.
>
> Have this as part of the controller, and am attempting to just
> instantiate a UserCode object based on that usercode ('007')
>
> u = UserCode.select( UserCode.q.usercode=='007' )
> n = u.name
>
> My model seems straightforward enough:
>
> class UserCode(SQLObject):
>     usercode = StringCol(length=3)
>     name = StringCol(length=30)
>     lastname = StringCol(length=30)
>     phone = StringCol(length=20)
>     email = StringCol(length=20)
>     date = DateCol()
>     usertrack = MultipleJoin('UserTrack')
>
> Anyway, so I keep getting an error that says:
>
> 'SelectResults' object has no attribute 'name'
>
> Oh, and I have manually entered the specific UserCode with '007' (so
> it should exist).
>
> Thanks in advance(!)


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to