On Tuesday 30 October 2007 16:27:42 [EMAIL PROTECTED] wrote:
> I have a model like so...
>
> class Employee(SQLObject):
> email = UnicodeCol(length=255, alternateID=True)
> fname = UnicodeCol(length=50)
> lname = UnicodeCol(length=50)
> supervisor = ForeignKey('User')
> incidents = MultipleJoin('Incidents')
>
> class Incidents(SQLObject):
> employee = ForeignKey('Employee')
> subject = UnicodeCol(length=50)
> itype = UnicodeCol(length=1)
> comments = StringCol()
>
> I want to display the total number of incidents for an employee.
>
> I thought I could just do this.
>
> emp = Employee.get(1)
> print emp.incidents.count
>
> But this just returns this ...
> <built-in method count of list object at 0x02727F80>
>
> Help on built-in function count:
>
> count(...)
> L.count(value) -> integer -- return number of occurrences of value
>
>
> I am positive I am missing something really obvious here.
You are not calling the method. Just do
print emp.incidents.count()
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---