I recently switched from sqlite to MS SQL and my application no longer allows me to add new records using the smartgrad. I have editable and deletable set to True but I can only view the records.
If I use a basic SQLFORM I can add records, but I would prefer using the smartgrid.
Is there a trick to getting it working with MS SQL?
This only allows me to view the record:
grid = SQLFORM.smartgrid(db.image, create=True, editable=True, deletable=True, linked_tables=['post'])
return dict(grid=grid)
With this is I can add new records:
record = db.image(request.args(0)) # Tries to get an existing record where the id is specified in the first argument if the url.
image_form = SQLFORM(db.image, record) # Creates a form based on the 'image' table. If a record was found, it will show the record details
if image_form.process().accepted: # When the form is submitted (not when it is created) it will try and process it and add the record or save any changes to the record.
response.flash = 'form accepted'
elif image_form.errors:
response.flash = 'form has errors'
return dict(grid=image_form)
Kind Regards,
David