You could set the "readable" and "writable" attributes of the fields you 
want to hide to False. Another option is to use SQLFORM instead of Crud and 
pass the "fields" argument with a list of fields to include. In this case, 
SQLFORM is probably just as easy to use as Crud.

bio_form = SQLFORM(db.event_attender, fields=['show_attendance', 'bio_text'
]).process()

Anthony

On Wednesday, May 16, 2012 3:43:09 AM UTC-4, encompass wrote:
>
> Many values I don't need to show in the view so I have done this: 
> def join(): 
>      ''' 
>      NOTES:Covers the event bio and any payments if needed. 
>      ''' 
>      event_details = db.event[request.args(0)] 
>      if not event_details: 
>          redirect(URL('default', 'index')) 
>      attender_count = db(db.event_attender.event == 
> request.args(0)).count() 
>      event_full = attender_count >= event_details.maximum_attendance 
>      payment_needed = event_details.ticket_cost 
>      db.event_attender.event.default = request.args(0) 
>      bio_form = crud.create(db.event_attender) 
>      return dict(event_full = event_full, 
>                  payment_needed = payment_needed, 
>                  event_details = event_details, 
>                  bio_form = bio_form) 
>
> With this in the view: 
> <div> 
>              {{=bio_form.custom.begin}} 
>              Show Attendance: {{=bio_form.custom.widget.show_attendance}} 
>              {{=bio_form.custom.widget.bio_text}} 
>              {{=bio_form.custom.submit}} 
>              {{=bio_form.custom.end}}</div> 
> If I print the form with {{=bio_form}} it works just fine, but I see all 
> the extra data fields. 
> Is there a way to fix this? 
> For a golden star I have the model as follows: 
> # -*- coding: utf-8 -*- 
> db.define_table('event_attender', 
>              Field('attender', db.auth_user), 
>              Field('event', db.event), 
>              Field('role', 'string', default="attender"), 
>              Field('status', 'string', default="not_present"), 
>              Field('show_attendance', 'boolean', default=True), 
>              Field('bio_text', 'text'), 
>              Field('QR_quick_connect', 'string') 
>              ) 
>
> db.event_attender.role.requires = IS_IN_SET(["attender", 'admin', 
> 'organizer', 'speaker', 'booth']) 
> db.event_attender.status.requires = IS_IN_SET(["present", 'not_present', 
> 'banned']) 
> db.event_attender.attender.requires = 
> IS_IN_DB(db,db.auth_user.id,'%(nickname)s') 
> db.event_attender.event.requires = IS_IN_DB(db,db.event.id,'%(name)s') 
> db.event_attender.bio_text.widget = lambda field,value: \ 
>      SQLFORM.widgets.text.widget(field,value,_class='text nicedit', 
> _style="color:red") 
> if auth.is_logged_in(): 
>      db.event_attender.attender.default = auth.user.id 
>
> Best Regards, 
> Jason Brower 
>

Reply via email to