Closed pendyalarajesh123 closed 7 years ago
I'm affraid I never used MSSQL.
It looks like there a type mismatch for ID - you try to use string for int? Why are you trying to update the pkey in the first place?
I am not updating the pkey, when I tried to update the title and blog content, it is redirecting and trying to update the ID which is the primary key. I took the source code from here and changed the sqlalchemy.url in development.ini file.
Ok,
I think I know the cause - I will update the example soon.
Thanks in advance.
Hi ergo, can you please give some updates on the above issue?
@pendyalarajesh123
I think the reason this happens is that here:
https://github.com/Pylons/pyramid_blogr/blob/master/pyramid_blogr/views/blog.py#L39
the form tries to use: https://github.com/Pylons/pyramid_blogr/blob/master/pyramid_blogr/forms.py#L13
the 'id' from the form is used as string - you can try changing BlogUpdateForm
to BlogCreateForm
in the view and this should fix the issue for you.
I'll update the tutorial (along with 1.8 changes) when I find the time.
Hi ergo, thanks for the information.
I changed the view blog.py in #line 39 as "form = BlogCreateForm(request.POST, entry)", still I am getting the below error.
"UndefinedError: 'pyramid_blogr.forms.BlogCreateForm object' has no attribute 'id'"
@pendyalarajesh123 please do https://docs.python.org/3/tutorial/ first to understand the basics of python programming, you should have much easier time to follow the tutorial.
Thanks for the info.
Should be fixed in latest version of tutorial
Hi,
I am able to create entries in DB, but when i tried to edit the entries, getting the error " ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot update identity column 'id'. (8102) (SQLExecDirectW); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (8180)") [SQL: u'UPDATE entries SET id=?, body=? WHERE entries.id = ?'] [parameters: (u'7', u'for testing in pyramid framework', 7)]".
Please some one help me on this.