def form_valid(self, transport, form, table_name=None, column_name=None, obj_id=None): # Save the form form.save() # Update the table blocks.update(transport, table_name)
def table_action(transport, table_name, action_name, *args, **kwargs): """ Call table action :param transport: achilles transport :param table_name: Name of the table calling this :param action_name: Name of the action to call """ # Get TableAction item context = RequestContext(transport.request, {}) table = blocks.get(table_name, context) action = getattr(table, action_name) # Call the action res = action.call(transport, table, *args, **kwargs) blocks.update(transport, table.register_name) return res
def row_action(transport, table_name, action_name, row_id, *args, **kwargs): """ Call table action on the given row :param transport: achilles transport :param table_name: Name of the table calling this :param action_name: Name of the action to call :param row_id: Id of the object """ # Get TableAction item context = RequestContext(transport.request, {}) table = blocks.get(table_name, context) action = getattr(table, action_name) # Get the object from the row obj = table.get_object(row_id) # Call the action res = action.call(transport, table, obj, *args, **kwargs) blocks.update(transport, table.register_name) return res
def delete(transport, table, obj): obj.delete() blocks.update(transport, table.register_name)
def delete_person(request, table, person): person.delete() blocks.update(request, 'example:mytable')
def miau_person(request, table, person): person.last_name = 'Miau ' + person.last_name person.save() blocks.update(request, 'example:mytable')
def form_valid(self, request, form): Person.objects.get_or_create(**form.cleaned_data) blocks.update(request, 'example:mytable')