I took the example code from Anvil Docs | Checks and Validation and stripped it down to the bare essentials:
from anvil.tables import app_tables
class TodoItem(app_tables.todos.Row, buffered=True, attrs=True, client_writeable=True):
def _do_delete(self, from_client):
super()._do_delete()
def _do_update(self, updates, from_client):
super()._do_update(updates)
@classmethod
def _do_create(cls, values, from_client):
return super()._do_create(values)
test = TodoItem(task="test")
test.save()
This gives me an error when I run it:
ErrorLoadingUserCode: Error loading user code: get_base_model_cls.<locals>.Row._do_create() missing 1 required positional argument: 'from_client'
If I pass from_client
to the super’s method, I get a permission error:
anvil.server.PermissionDenied: Cannot write to table 'todos' from client code.
What am I missing here?
Clone link:
EDIT
using super()._do_create(values, False)
works but that feels wrong.