Closed sih4sing5hong5 closed 2 years ago
piann_haikhau_piantiau(obj.羅馬字含口語調)
是bs4
形態,直接save()
敢無問題?
Tī shell內底試mā是按呢:
>>> obj.羅馬字含口語調 = piann_haikhau_piantiau(obj.羅馬字含口語調)
>>> obj.save()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/app/sekchi/models.py", line 66, in save
super().save(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 806, in save
self.save_base(
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 857, in save_base
updated = self._save_table(
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 970, in _save_table
updated = self._do_update(
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 1034, in _do_update
return filtered._update(values) > 0
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 881, in _update
query.add_update_fields(values)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/subqueries.py", line 113, in add_update_fields
val = val.resolve_expression(self, allow_joins=False, for_save=True)
TypeError: 'NoneType' object is not callable
ke一个 str()
tō好勢--ah:
>>> obj.羅馬字含口語調 = str(piann_haikhau_piantiau(obj.羅馬字含口語調))
>>> obj.save()