Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def update(self, *, model, pk, values) -> Optional[int]:
Return num rows changed
"""
data = {}
for col, model, value in values:
for col, _, value in values:
data[self.COLUMN_MAPPING.get(col.name, col.name)] = value

r = requests.put(f"https://jsonplaceholder.typicode.com/todos/{pk}", json=data)
Expand Down
44 changes: 44 additions & 0 deletions example_projects/jsonserver-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# Example project: typicode/json-server


This example project uses the full fake REST API from [typicode/json-server](https://github.com/typicode/json-server)

Please note that this API is readonly and changes (insert, update & delete) won't be applied!

## Running example project


1. Create and activate Virtual Environment

python3 -m venv .venv
source .venv/bin/activate

2. Install requirements:

pip install -r requirements.txt

3. Create local SQLite database:

python manage.py migrate

4. Load sample data:

python manage.py loaddata mysite/fixtures/initial_data

5. Run Django server:

python manage.py runserver

6. Install JSON server:

npm install -g json-server

6. Run JSON server:

json-server --watch db.json


6. Take a look at:
- Movies view: <http://127.0.0.1:8000/books/>
- Django Admin: <http://localhost:8000/admin/> (log in with username `admin` and password `admin`)
Loading