perfect thanks
what I did to also show the fields is

table.created_on.update = record.created_on = request.now
table.edited_by.update = record.edited_by = auth.user.id


On Jul 3, 12:42 am, mdipierro <[email protected]> wrote:
> You can change the value of fields that are not writable.
>
> You have to set db.table.field.default=... to set the value on
> creation and db.table.field.update=... to set the value on update.
>
> On 2 Lug, 09:31, selecta <[email protected]> wrote:
>
>
>
> > this is a question
> > I thought I would be able to change a value of a field that is not
> > writable for the user
> > if this is not possible please consider this as a suggestion
>
> > On Jul 2, 3:03 pm, mdipierro <[email protected]> wrote:
>
> > > is this a question or a suggestion? ;-)
>
> > > On 2 Lug, 07:20, selecta <[email protected]> wrote:
>
> > > > I want to change the value of a field that is writable=False of a form
> > > > that was created with crud.update
>
> > > > def edit():
> > > >     table, record = getTableRecord(request)
> > > >     if record:
> > > >         #this will show the right content but will not be stored in db
> > > >         record.created_on = request.now
> > > >         record.edited_by = auth.user.id
> > > >     #this does not have any effect
> > > >     table.created_on.default = request.now
> > > >     table.edited_by.default = auth.user.id
>
> > > >     form = crud.update(table, record, onaccept=crud.archive, deletable
> > > > = False)
>
> > > >     #this also does not have any effect
> > > >     form.vars.created_on = request.now
> > > >     form.vars.edited_by = auth.user.id
>
> > > >     return dict(form = form)

Reply via email to