From b4c5ef35d777a49f47b43d64815e2cc8197c5cef Mon Sep 17 00:00:00 2001 From: Muflone Date: Sun, 6 Jun 2021 21:07:27 +0200 Subject: [PATCH] Create, update and delete the same record --- samples/contacts.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/contacts.py b/samples/contacts.py index 516f24d..4b5b586 100644 --- a/samples/contacts.py +++ b/samples/contacts.py @@ -73,20 +73,20 @@ fields=('id', 'name')) print('get', results) +# Create a new record +entity_id = model.create(values={'firstname': 'TEST TEST TEST', + 'lastname': '123 456'}) +print('create', entity_id) + # Update a record by ID -model.update(entity_id=24551, - values={'pinned_notes': 'TEST TEST TEST'}) -results = model.get(entity_id=24551, - fields=('id', 'pinned_notes')) +model.update(entity_id=entity_id, + values={'street': 'TEST TEST TEST'}) +results = model.get(entity_id=entity_id, + fields=('id', 'street')) print('update', results) -# Create a new record -results = model.create(values={'firstname': 'TEST TEST TEST', - 'lastname': '123 456'}) -print('create', results) - # Delete a record -model.delete(entity_id=results) +model.delete(entity_id=entity_id) print('delete') # Find customers from France with different languages