controller:
def gerenciar_grupos():
form_not_usu = SQLFORM.factory(
Field('usuarios', requires=IS_IN_DB(db,
db.auth_user,'%(email)s',multiple=True),widget=SQLFORM.widgets.checkboxes.widget,
default=True),
)
return dict( form_not_usu = form_not_usu)
view:
{{extend 'layout.html'}}
{{=form_not_usu.custom.begin}}
<ul>
{{for x in form_not_usu.custom.widget.usuarios:}}
{{=LI(x)}}
{{pass}}
</ul>
{{=form_not_usu.custom.submit}}
{{=form_not_usu.custom.end}}
Checkboxes are not checked when accessing the page.
Em terça-feira, 10 de julho de 2012 16h46min48s UTC-3, Richard escreveu:
>
> in your model Field(..., default=True) or in the controller
> db.table.field.default=True
>
> You also need to use checkbox widget.
>
> Richard
>
> On Tue, Jul 10, 2012 at 2:39 PM, Fabiano Faver <[email protected]> wrote:
>
>> I want to creat something similar to SQLFORM(auth_membership) but I want
>> the user to choose a group and all users show up as checkboxes and users
>> who already belong to this group are checked as well.
>>
>> I`m downt know how to pre-select these auth_users.
>>
>> any tips?
>>
>
>