Massimo,
Thanks for pointing me in the right direction, I had to add the next
argument to the crud.update() function to get the check to delete work
properly. There's one small problem to solve, when the user logs in
the flash reads: Logged in. Whereas, I would like it to read 'Insert
tagline' or 'Update tagline'.
The function:
@auth.requires_login()
def index():
response.functionname='Basic account'
record=db(db.tagline.bedrijf_id==auth.user.bedrijf_id).select().first()
if record:
if not response.init_flash: response.init_flash='Update
tagline'
message='Tagline updated'
else:
if not response.init_flash: response.init_flash='Insert
tagline'
message='Tagline inserted'
db.tagline.bedrijf_id.default=auth.user.bedrijf_id
form=crud.update(db.tagline,record,next=(URL(r=request,f='index')),message=message)
return dict(form=form)
The view:
<div id="oneColLayout">
<div id="primarycontent">
{{if response.functionname:}}
<h2>{{=response.functionname}}</h2>
{{pass}}
{{if response.flash:}}
<div class="flash">
{{=response.flash}}
</div> <!-- flash -->
{{else:}}
<div class="flash">
{{=response.init_flash}}
</div> <!-- flash -->
{{pass}}
{{if form:}}
{{=form}}
{{pass}}
</div> <!-- primarycontent -->
</div> <!-- oneColLayout -->
Kind regards,
Annet.