Skip to Content
Menu
This question has been flagged
2 Replies
6434 Views

Hi ,
I want to update model from web controller , but I got this error when getting the current record id :
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'


<form action="/update/teacher">
        <input type="text" class="form-control" id="teacher_name" name="teacher_name"
               t-att-value="teacher_id.teacher_name"/>
    <button type="submit" class="btn btn-default">Submit</button>
</form>


@http.route('/update/teacher', type="http", website=True, auth="public")
    def update_teacher(self, **kw):
        http.request.env['academy.teacher'].browse(kw.get('id')).write(
            {
                'teacher_name': kw.get('teacher_name')
            }
            )

Any help please ?
Thanks.

Avatar
Discard
Best Answer

you have to add input hidden in your post call like

            <input type="hidden" name="id" t-att-value="teacher.id"/>


Avatar
Discard
Related Posts Replies Views Activity
3
Apr 24
1004
0
May 24
46
1
Apr 24
1822
4
Sep 23
3076
2
Sep 23
5592