i3thuan5 / SuiSiann-KauTui

台灣媠聲標記網站
12 stars 3 forks source link

Applying sekchi.0008_換掉海口腔變調 有錯誤 #365

Closed sih4sing5hong5 closed 2 years ago

sih4sing5hong5 commented 2 years ago
Running migrations:
  Applying sekchi.0005_sekchi_對齊狀態... OK
  Applying sekchi.0006_alter_sekchi_對齊狀態... OK
  Applying sekchi.0007_sekchi_口語調狀態... OK
  Applying sekchi.0008_換掉海口腔變調...Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 98, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 290, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.8/site-packages/django/db/migrations/executor.py", line 131, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.8/site-packages/django/db/migrations/executor.py", line 163, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.8/site-packages/django/db/migrations/executor.py", line 248, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.8/site-packages/django/db/migrations/migration.py", line 131, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/app/sekchi/migrations/0008_換掉海口腔變調.py", line 15, in haikhau_piantiau
    obj.save()
  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
sih4sing5hong5 commented 2 years ago

https://github.com/i3thuan5/SuiSiann-KauTui/blob/22d4901d5b2146ab7691f546f6adac8e0c9b4817/sekchi/migrations/0008_%E6%8F%9B%E6%8E%89%E6%B5%B7%E5%8F%A3%E8%85%94%E8%AE%8A%E8%AA%BF.py#L14

piann_haikhau_piantiau(obj.羅馬字含口語調)bs4形態,直接save()敢無問題?

niauah commented 2 years ago

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()