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 <gr...@delarue-berlin.de> 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 <mdipie...@cs.depaul.edu> wrote:
>
> > is this a question or a suggestion? ;-)
>
> > On 2 Lug, 07:20, selecta <gr...@delarue-berlin.de> 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