Change to modelform, and the code in views is as follows:
form.instance.comment_man = request.user form.instance.comment_course_id = couseid form.instance.comment_comment = textcontent form.instance.add_time = timezone.now() form.save()
Read More:
- [Solved] AttributeError: ‘DataParallel‘ object has no attribute ‘save‘
- [Solved] Django Error: Attributeerror: ‘wsgirequest’ object has no attribute ‘is_ajax ‘
- [Solved] AttributeError WriteOnlyWorksheet object has no attribute cell
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘append‘
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- AttributeError: DatetimeProperties object has no attribute
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘map‘
- [Solved] AttributeError: ‘_IncompatibleKeys’ object has no attribute
- [Solved] Paramiko error: AttributeError: ‘NoneType’ object has no attribute ‘time’
- [Solved] AttributeError: ‘HTMLWriter‘ object has no attribute ‘_temp_names‘
- [Python] Right-click Selenium to Save the picture error: attributeerror: solution to module ‘pyscreen’ has no attribute ‘locationonwindow’
- [Solved] AttributeError: DataFrame object has no attribute’xxx’
- [Solved] AttributeError: ‘_IncompatibleKeys‘ object has no attribute ‘parameters‘
- [Solved] AttributeError: ‘DataFrame‘ object has no attribute ‘tolist‘
- [Solved] AttributeError: ‘NoneType‘ object has no attribute ‘astype‘
- [Solved] AttributeError: ‘str‘ object has no attribute ‘decode‘
- [Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘
- [Solved] Networkx Error: Attributeerror: ‘graph’ object has no attribute ‘node’
- How to Solve Python AttributeError: ‘module’ object has no attribute ‘xxx’
- [2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘