On Friday, June 16, 2017 at 4:23:15 PM UTC-4, jim kaubisch wrote:
>
> Hmmm,
>
> Chapter 7 of the book under "record versioning" says:
>
> Should you wish to access the archive table you should define it in a
> model:
>
> 1
> 2
> 3
>
> db.define_table('mytable_archive',
> Field('current_record', 'reference mytable'),
> db.mytable)
>
>
>
That is in the section about using auth.archive for record versioning,
which is not the method you are using. In the Auth chapter where
auth.enable_record_versioning() is described, it says:
If you enable_record_versioning, you should not use auth.archive or
crud.archive else you will end up with duplicate records. Those functions
do explicitly what enable_record_versioning does automatically and they
will be deprecated.
>
> I want the option of looking into the Archive table (using
> db(query,ignore_common_filters=True).select(....) as per one of Massimo's
> postings),
> in order to, for example, run reports concerning the number and nature of
> changes, by whom over a period of time etc. - so I declared all the archive
> tables :( :(
>
auth.enable_record_versioning() does in fact define the tables, so you can
access them via the DAL as you desire -- you just don't have to define them
explicitly. Actually, auth.archive also defines the tables, but the reason
the book suggests defining the table yourself if you need to query it is
that auth.archive is used as a callback of SQLFORM, so its table
definitions exist only during requests that involve calls to the relevant
SQLFORM code. auth.enable_record_versioning, on the other hand, is
typically called in a model file and therefore makes the archive table
definitions available in all requests.
> re. the ".editable" - lack of familiarity with what's going on. Was trying
> to protect against the potential of a form trying to edit the archive table
>
Sure, but did you see that somewhere? That functionality doesn't exist.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.