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
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/0c50ff77-0a87-4617-b69c-b157763c7bcfn%40googlegroups.com.