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)