I tried it and this is NOT how it works the current_record Field always points to the latest version thus you can do
current_record_version = db(getattr(db,table_info.sql_name +"_archive").current_record==current_record.id).count() and saving created_on for every version is essential since otherwise the edit history cannot be constructed properly On Jul 2, 12:10 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Looks good. This assumes you you created the table_name+'_archive' > according to crud.archive. > > On 2 Lug, 04:09, selecta <gr...@delarue-berlin.de> wrote: > > > > > How do I display the edit history? > > > For example I want to preserve the original creator and see who edited > > it. How I understand this right now I would add the following fields > > to each table that is archived > > > Field('created_by',default=auth.user_id,update=auth.user_id,writable=False), > > Field('edited_by',default=auth.user_id,update=auth.user_id,writable=False), > > Field('created_on',default=request.now,update=request.now,writable=False) > > > and then get the history with > > > table_name = 'example' > > current_record = record > > history = [] > > while current_record: > > current_record = db(getattr(db,table_name+"_archive").current_record > > ==current_record.id).select().first() > > history.insert(0, current_record) > > > and then display the history with something like > > versions: {{= ' '.join(["v%s (%s %s)"%(i, record.edited_by, > > record.created_on) for i,record in enumerate(history)]}} > > > is this right?