That is exactly the way I always handle it. I leave everything enabled in the controller (except the id column) and control the readability/writability in the controller.

    -Jim

On 4/9/2012 12:41 PM, blackthorne wrote:
Thank you. Didn't know that applies to smartgrids as well.

now, because I don't want to change that (it would break things in many other places...) do you think there is a problem if I do something like in the controller:

   ....
    db.attachment.submitted_by.readable=True
    form = SQLFORM.smartgrid...

and leave the model as it is?

Thanks

On Monday, 9 April 2012 17:50:40 UTC+1, Jim S wrote:

    readable and writable need to be true on the submitted_by field.

        -Jim

    On 4/9/2012 11:44 AM, blackthorne wrote:
    I'm trying to make a smartgrid using a table that has references
    to other (auth_user). The smartgrid show up but it does not
    include the field where I reference the other table.

    with code:

    -- in the db:

    auth = Auth(db, hmac_key=Auth.get_or_create_key())
    crud, service, plugins = Crud(db), Service(), PluginManager()

    ## create all tables needed by auth if not custom tables
    auth.define_tables()
    ...

    db.define_table('attachment',
        Field('name'),
        Field('filename'),
        Field('submitted_by', db.auth_user, default=None,
    readable=False, writable=False),
        format='%(name)s')

    -- in the controllers:
    def show_files():
        form = SQLFORM.smartgrid(db.attachment)
        return dict(form=form)

    The generated smargrid does not show the "submitted_by" field.
    How can I make that happen?
     I would like to see auth_user representation and if I click on
    it brings the complete auth_user entry.


    Thank you

    P.S.: In the book there is an example that shows the "opposite"
    of what I want to do using the linked_tables=[] parameter that
    allows us to drill down from a parent smartgrid into a child.

Reply via email to