Thanks Anthony, works perfect. Yes, it needs to changeable. I have the
following tables:
member, campaign and memberCampaign
When I'm using SmartGrid to display members, I need the memberCampaign
label to say Campaigns, but when I'm using SmartGrid for Campaigns, the
memberCampaign label needs to say Members.
Adding the line below in my controller code allows that.
Thanks again,
-Jim
On 10/3/2011 3:20 PM, Anthony wrote:
From the code, it looks like you would define _plural at table
definition time:
db.define_table('memberCampaign', singular='Campaign',
plural='Campaigns', ...)
But it should probably be made changeable. Actually, for now you can do:
db.memberCampaign['_plural'] = 'Campaigns'
Anthony
On Monday, October 3, 2011 3:36:54 PM UTC-4, Jim S wrote:
This didn't work for me, but maybe I'm applying it in the wrong spot.
My controller is:
@auth.requires_login()
def members():
response.view = 'list.html'
columns = ['member.firstName', 'member.lastName', 'member.city',
'member.state', 'member.phone', 'member.joinedOn',
'memberCampaign.campaignId',
'memberCampaign.amount', 'memberCampaign.paidOn',
'memberTag.tagId']
db.memberCampaign._plural = 'Campaigns'
grid = SQLFORM.smartgrid(db.member, columns=columns,
details=False,
ui='jquery-ui', csv=False)
return dict(grid=grid)
Running this I get:
Traceback (most recent call last):
File "C:\dev\web2py\gluon\restricted.py", line 194, in restricted
exec ccode in environment
File "C:/dev/web2py/applications/dalc/controllers/default.py",
line
118, in <module>
File "C:\dev\web2py\gluon\globals.py", line 149, in <lambda>
self._caller = lambda f: f()
File "C:\dev\web2py\gluon\tools.py", line 2467, in f
return action(*a, **b)
File "C:/dev/web2py/applications/dalc/controllers/default.py",
line
100, in members
db.memberCampaign._plural = 'Campaigns'
File "C:\dev\web2py\gluon\dal.py", line 4981, in __setattr__
raise SyntaxError, 'Object exists and cannot be redefined:
%s' % key
SyntaxError: Object exists and cannot be redefined: _plural
Just created my environment from trunk.
Thoughts?
-Jim
On 10/3/2011 12:59 PM, Massimo Di Pierro wrote:
>
> On Oct 3, 5:07 am, andrej burja<andrej...@gmail.com> wrote:
>> hi
>>
>> how could i add a sum in the linked table?
>> i have person, linked table payments. Opening the payments
table from person
>> table, displaying only payments from that person, i would like
to display
>> the sum for that person. How can i do that?
> That's a good idea for a new feature. Please open a ticket
>
>> and how to change the label on button 't_payments'?
> db.t_payments._plural = 'My Payments' # requires trunk
>
>
>
>> andrej