You are doing nothing wrong, perhaps you had a misunderstanding of how 
versioning works.

Do do what you want, look at the before_delete callback. You'd want to 
return 'true' to abort the delete operation.

http://web2py.com/books/default/chapter/29/06#before-and-after-callbacks



On Monday, October 8, 2012 12:04:09 PM UTC-7, Cliff Kachinske wrote:
>
> I have the following, but checking the delete box actually deletes the 
> record rather than setting is_active to False.
>
> It creates records in the archive table, but I also want them to stay in 
> the main table with is_active set to False.
>
> What am I doing wrong?
>
> Thank you,
> Cliff Kachinske
>
> Model
> db.define_table('documentation',
>     Field('name', length=36, label='Name'),
>     # I put this in just before Massimo announced request_tenant
>     # Timing is everything!
>     Field('tenant_link', db.tenants, 
>          default=session.auth.user.tenant_link),
>     auth.signature,
>     format='%(name)s')
> db.documentation.tenant_link.requires = IS_IN_DB(
>     db, db.tenants.id, '%(name)s', zero='Choose')
> db.documentation.tenant_link.readable = False
> db.documentation.tenant_link.writable = False
>
> #More tables ...
>
> auth.enable_record_versioning(db)
> db.auth_permission.table_name.requires = IS_IN_SET(db.tables)
>
> Controller:
> def edit():
>     form = crud.update(
>            db.documentation, request.args(0), next=next,
>            # Commented out to avoid multiple records in the archive table 
> while testing
>            # Does not affect the problem either way
>            # onaccept=auth.archive,
>            )
>     return dict(form=form, h2='Edit')
>
>
>

-- 



Reply via email to