I'm using the new format of the google group and see them as attachments at the bottom of the post. I can create new ones if that helps?

    -Jim

On 9/14/2011 10:07 PM, Massimo Di Pierro wrote:
I do not see the screenshot. :-(
This should work, although may not work the way you want.

On Sep 14, 4:48 pm, Jim Steil<j...@qlf.com>  wrote:
In response to #3, I see what is going on now.  I'm working on a
membership database where I have the following model:

#######  db.py
member = db.define_table('member',
      Field('memberId', 'id'),
      Field('firstName', length=50, required=True, label='First Name'),
      Field('middleInitial', length=20, label='Middle Initial'),
      Field('lastName', length=50, required=True, label='Last Name'),
      Field('secondFirstName', length=50, label='Second First Name'),
      Field('secondLastName', length=50, label='Second Last Name'),
      Field('householdSalutation', length=50, label='Household Salutation'),
      Field('householdFirstName', length=50, label='Household First Name'),
      Field('businessName', length=128, label='Business Name'),
      Field('address', 'text'),
      Field('city', length=50),
      Field('state', length=2),
      Field('postalCode', length=10, label='Postal Code'),
      Field('homePhone', length=25, label='Home Phone'),
      Field('email', length=255),
      Field('legaciesBequests', 'decimal(11,2)', label='Legacies and
Bequests'),
      Field('notes', 'text'),
      Field('joinedOn', 'date', label='Joined On',
            default=datetime.date.today(),
            requires=IS_DATE(format='%m/%d/%Y'),
            represent=lambda value, x: value.strftime('%m/%d/%Y')),
      Field('deceased', 'boolean', default=False))

member.firstName.requires = IS_NOT_EMPTY()
member.lastName.requires = IS_NOT_EMPTY()

campaign = db.define_table('campaign',
      Field('campaignId', 'id'),
      Field('name', length=50, required=True, unique=True),
      Field('start', 'date', required=True,
            default=datetime.date.today(),
            requires=IS_DATE(format='%m/%d/%Y'),
            represent=lambda value, x: formatDate(value)),
      Field('end', 'date',
            requires=IS_NULL_OR(IS_DATE(format='%m/%d/%Y')),
            represent=lambda value, x: formatDate(value),
            ))

campaign.name.requires = [IS_NOT_EMPTY(),
                            IS_NOT_IN_DB(db, 'campaign.name')]

memberCampaign = db.define_table('memberCampaign',
      Field('memberId', db.member, required=True, label='Member'),
      Field('campaignId', db.campaign, required=True, label='Campaign'),
      Field('amount', 'decimal(13,2)'),
      Field('paidOn', 'date', label='Paid On',
            default=datetime.date.today().strftime('%m/%d/%Y'),
            requires=IS_DATE(format='%m/%d/%Y'),
            represent=lambda value, x: value.strftime('%m/%d/%Y')))

memberCampaign.memberId.requires = IS_IN_DB(db, db.member.id,
                                       '%(firstName) %(lastName)s',
                                       zero=('select member'))
memberCampaign.campaignId.requires = IS_IN_DB(db, db.campaign.campaignId,
                                        '%(name)s', zero=('select campaign'))

tag = db.define_table('tag',
      Field('tagId', 'id'),
      Field('name', length=50, required=True, unique=True))

tag.name.requires = [IS_NOT_EMPTY(),
                       IS_NOT_IN_DB(db, 'tag.name')]

memberTag = db.define_table('memberTag',
      Field('memberId', db.member, required=True, label='Member'),
      Field('tagId', db.tag, required=True, label='Tag'))

memberTag.memberId.requires = IS_IN_DB(db, db.member.id,
                                      '%(firstName) %(lastName)s',
                                      zero=('select member'))
memberTag.tagId.requires = IS_IN_DB(db, db.tag.id,
                                      '%(name)s', zero=('select tag'))

######
and the following controller

######  default.py
def members():
      columns = ['member.firstName', 'member.lastName', 'member.city',
                 'member.state', 'member.phone', 'member.joinedOn',
                 'member.deceased']
      orderBy = ['member.lastName']
      grid = SQLFORM.smartgrid(db.member, columns=columns, details=False)
      return dict(grid=grid)

######

Here are screen shots of the progression through it:

Click on memberTag

Click on Add

Not sure what this all means as I'm not sure of the intent of the
SQLFORM.smartgrid().  But, I was assuming (yes I know that's bad) that
it would create an entry form for me with the default member already
selected.

Would be fantastic if this worked.  If it is a while out, I will go
ahead and create some custom views to do this, but if it could work,
that would be fantastic.  Any thoughts?

      -Jim

On 9/14/2011 11:01 AM, Jim Steil wrote:







I understand that these two grid are brand new, but has anyone created
any documentation on all of the options and how to use them yet?
Here are a couple issues I'm wondering about:
1.  In reading this post -
https://groups.google.com/forum/#!msg/web2py/1eSMh8TlHGs/rB9Hx2UIP4cJ
- and looking at the images provided, how do I get the buttons to
display instead of just link text.
2.  Can I override the default links for Add and Edit?
3.  What is the difference between grid and smartgrid?
I'm happy to proof/test any documentation that is in progress.  I'm
just eager to get to work with these great new tools.
     -Jim

--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell

Reply via email to