Thank you very much.
I have found something in chapter 07 of THE BOOK and I will try all
proposals.

2011/12/7 Johann Spies <[email protected]>

> On 7 December 2011 13:17, Martin Weissenboeck <[email protected]> wrote:
>
> I modified your code a little bit.  That is not quite what you want but on
> the condition that you already have records in table 'cv' a person can edit
> a record without touching the field 'person'.
>
> You probably have to define a function to add records to 'cv' and modify
> the SQLFORM-grid to let the 'add' button refer to that function where the
> 'person' field will be writable.
>
> I don't know hot to change the link in the 'add' button in the grid.
> Maybe someone else can help.
>
>
> Model:
>
>
> db.define_table('person',
>                 Field('name'),
>                 format = '%(name)s')
>
>
> db.define_table('cv',  # curriculum vitae
>                 Field('person', 'reference person'),
>                 Field('status',requires =
> IS_IN_SET(['student','teacher','something else'])),
>                 Field('date','date'),
>                 )
>
> Controller:
>
> def editcv():
>     query = db.cv.id > 0
>     db.cv.person.writable = False
>     links = [lambda row: A('Add' , _href = URL('default', 'add_cv',
>                                                         args = [row.id]))]
>     return dict(grid=SQLFORM.grid(query,
>                                        user_signature=False))
>
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>


-- 
Mit freundlichen Grüßen / With kind regards
Martin Weissenböck
Gregor-Mendel-Str. 37, 1190 Wien
Austria / European Union
Tel  +43 1 31400 00
Fax  +43 1 31400 700

Reply via email to