From b2e8047f1c0c3181054039fbc3fd06fa0597c300 Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Mon, 2 Oct 2023 17:50:49 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=8C=90=20Add=20German=20translation?= =?UTF-8?q?=20for=20`docs/de/docs/tutorial/request-forms-and-files.md`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Full translation * In sync with current docs/en/docs/tutorial/request-forms-and-files.md * Manually translated (Google translate rarely used) * Checked for errors using LanguageTool * Manually checked --- .../docs/tutorial/request-forms-and-files.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/de/docs/tutorial/request-forms-and-files.md diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md new file mode 100644 index 0000000000000..18dc3c6d1d59c --- /dev/null +++ b/docs/de/docs/tutorial/request-forms-and-files.md @@ -0,0 +1,69 @@ +# Formulardaten und Dateien im Request + +Sie können gleichzeitig Dateien und Formulardaten mit `File` und `Form` definieren. + +!!! info + Um hochgeladene Dateien und/oder Formulardaten zu empfangen, installieren Sie zuerst `python-multipart`. + + Z.B. `pip install python-multipart`. + +## `File` und `Form` importieren + +=== "Python 3.9+" + + ```Python hl_lines="3" + {!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!} + ``` + +=== "Python 3.6+" + + ```Python hl_lines="1" + {!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!} + ``` + +=== "Python 3.6+ nicht annotiert" + + !!! tip + Bevorzugen Sie die `Annotated`-Version, falls möglich. + + ```Python hl_lines="1" + {!> ../../../docs_src/request_forms_and_files/tutorial001.py!} + ``` + +## `File` und `Form`-Parameter definieren + +Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Query` machen würden: + +=== "Python 3.9+" + + ```Python hl_lines="10-12" + {!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!} + ``` + +=== "Python 3.6+" + + ```Python hl_lines="9-11" + {!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!} + ``` + +=== "Python 3.6+ nicht annotiert" + + !!! tip + Bevorzugen Sie die `Annotated`-Version, falls möglich. + + ```Python hl_lines="8" + {!> ../../../docs_src/request_forms_and_files/tutorial001.py!} + ``` + +Die Datei- und Formularfelder werden als Formulardaten hochgeladen, und Sie erhalten diese Dateien und Formularfelder. + +Und Sie können einige der Dateien als `bytes` und einige als `UploadFile` deklarieren. + +!!! warning "Achtung" + Sie können mehrere `File`- und `Form`-Parameter in einer *Pfadoperation* deklarieren, aber Sie können nicht gleichzeitig auch `Body`-Felder deklarieren, welche Sie als JSON erwarten, da der Request den Body mittels `multipart/form-data` statt `application/json` kodiert. + + Das ist keine Limitation von **FastAPI**, sondern Teil des HTTP-Protokolls. + +## Rekapitulation + +Verwenden Sie `File` und `Form` zusammen, wenn Sie Daten und Dateien zusammen im selben Request empfangen müssen. From f03b70f66a63a98fc361b66fb56e2bd6b1015a8d Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Thu, 5 Oct 2023 05:02:00 +0200 Subject: [PATCH 2/5] "Rekapitulation" -> "Zusammenfassung" --- docs/de/docs/tutorial/request-forms-and-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md index 18dc3c6d1d59c..2c0179b17abdf 100644 --- a/docs/de/docs/tutorial/request-forms-and-files.md +++ b/docs/de/docs/tutorial/request-forms-and-files.md @@ -64,6 +64,6 @@ Und Sie können einige der Dateien als `bytes` und einige als `UploadFile` dekla Das ist keine Limitation von **FastAPI**, sondern Teil des HTTP-Protokolls. -## Rekapitulation +## Zusammenfassung Verwenden Sie `File` und `Form` zusammen, wenn Sie Daten und Dateien zusammen im selben Request empfangen müssen. From 32202f8400d6adcf1e27c311d4d3dd6fcd74e2f9 Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Tue, 17 Oct 2023 20:24:21 +0200 Subject: [PATCH 3/5] Sync with #10442 --- docs/de/docs/tutorial/request-forms-and-files.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md index 2c0179b17abdf..5bceb37d3f32b 100644 --- a/docs/de/docs/tutorial/request-forms-and-files.md +++ b/docs/de/docs/tutorial/request-forms-and-files.md @@ -15,13 +15,13 @@ Sie können gleichzeitig Dateien und Formulardaten mit `File` und `Form` definie {!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!} ``` -=== "Python 3.6+" +=== "Python 3.8+" ```Python hl_lines="1" {!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!} ``` -=== "Python 3.6+ nicht annotiert" +=== "Python 3.8+ nicht annotiert" !!! tip Bevorzugen Sie die `Annotated`-Version, falls möglich. @@ -40,13 +40,13 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q {!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!} ``` -=== "Python 3.6+" +=== "Python 3.8+" ```Python hl_lines="9-11" {!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!} ``` -=== "Python 3.6+ nicht annotiert" +=== "Python 3.8+ nicht annotiert" !!! tip Bevorzugen Sie die `Annotated`-Version, falls möglich. From 4e89f011dac25bba3eed17e5258e8085bb247951 Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Sun, 22 Oct 2023 18:21:09 +0200 Subject: [PATCH 4/5] "Tip" -> "Tipp" --- docs/de/docs/tutorial/request-forms-and-files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md index 5bceb37d3f32b..178f05631b010 100644 --- a/docs/de/docs/tutorial/request-forms-and-files.md +++ b/docs/de/docs/tutorial/request-forms-and-files.md @@ -23,7 +23,7 @@ Sie können gleichzeitig Dateien und Formulardaten mit `File` und `Form` definie === "Python 3.8+ nicht annotiert" - !!! tip + !!! tip "Tipp" Bevorzugen Sie die `Annotated`-Version, falls möglich. ```Python hl_lines="1" @@ -48,7 +48,7 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q === "Python 3.8+ nicht annotiert" - !!! tip + !!! tip "Tipp" Bevorzugen Sie die `Annotated`-Version, falls möglich. ```Python hl_lines="8" From 270dccb52e8437e9169dadfb28a9e5868f014d1a Mon Sep 17 00:00:00 2001 From: Nils Lindemann Date: Mon, 18 Dec 2023 20:35:33 +0100 Subject: [PATCH 5/5] "z.B." -> "z. B." --- docs/de/docs/tutorial/request-forms-and-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md index 178f05631b010..86b1406e6116c 100644 --- a/docs/de/docs/tutorial/request-forms-and-files.md +++ b/docs/de/docs/tutorial/request-forms-and-files.md @@ -5,7 +5,7 @@ Sie können gleichzeitig Dateien und Formulardaten mit `File` und `Form` definie !!! info Um hochgeladene Dateien und/oder Formulardaten zu empfangen, installieren Sie zuerst `python-multipart`. - Z.B. `pip install python-multipart`. + Z. B. `pip install python-multipart`. ## `File` und `Form` importieren