Revert "Add example of file upload to record (#9)"

This reverts commit 428d18c387547b94d6caaddbcb278d30d0e12dd2.
This commit is contained in:
Vithor Jaeger 2022-11-25 20:45:26 -04:00 committed by GitHub
parent 428d18c387
commit bda1d2846d

View File

@ -22,27 +22,21 @@ The rule of thumb here is just to use it as you would <a href="https://github.co
```python ```python
from pocketbase import PocketBase # Client also works the same from pocketbase import PocketBase # Client also works the same
from pocketbase.client import FileUpload
client = PocketBase('http://127.0.0.1:8090') client = PocketBase('http://127.0.0.1:8090')
# authenticate as regular user ...
user_data = client.collection("users").auth_with_password(
"user@example.com", "0123456789")
# or as admin
admin_data = client.admins.auth_with_password("test@example.com", "0123456789")
# list and filter "example" collection records # list and filter "example" collection records
result = client.collection("example").get_list( result = client.records.get_list(
1, 20, {"filter": 'status = true && created > "2022-08-01 10:00:00"'}) "example", 1, 20, {"filter": 'status = true && created > "2022-08-01 10:00:00"'}
)
# create record and upload file to image field # authenticate as regular user
result = client.collection("example").create( user_data = client.users.auth_via_email("test@example.com", "123456")
{
"status": "true", # or as admin
"image": FileUpload(("image.png", open("image.png", "rb"))), admin_data = client.admins.auth_via_email("test@example.com", "123456")
})
# and much more... # and much more...
``` ```