Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So, let's now start adding a form,
a standard HTML form in this review.html file,
and then thereafter, we're going to make sure
that this template also gets rendered by our view,
which it currently isn't and that we then also try
to handle the form submission.
But first of all, let's start with the form.
For this, we create this form tag,
we use the forum tag to default HTML form element
and then in such a form we can output all the inputs
we wanna have in that form.
So, to start simple, we could add an input of type="text"
let's say, the default HTML input element,
and that would allow users to enter some text.
Now we can give us input a label to give the user a hint
about data the user should enter here
and there we could expect the user name,
so we say your name and it's also then considered
a good practice for accessibility to connect label
and input with special attributes in HTML,
and give the label a four attribute where you point
at the ID of another element to which this label is related.
So here we could point at an element with ID name
and then give this input the ID name
so that for screen readers, for example,
it's clear that this label refers to this input element.
We also wanna give this input a name attribute.
So, here I picked name as an ID name,
I could've picked anything.
Maybe let's go with username to make that less confusing,
so, username it is here
but then the name attribute is a special attribute.
We can add to form elements like this input element,
and this will then allow us to identify
the submitted values once the form was submitted.
And here I'll also use username as a value here
but we could use a different value than we did here,
It doesn't have to be the same one.
Now, we have a form with one input element,
we now also should add a button which can be
pressed to submit the form.
And here Alt + End gives a caption of send.
Now this is all just HTML and if this is totally unclear
you definitely should revise those HTML basics.
We're just creating an HTML form here.
Now, before we do anything else here,
before we add any other configuration,
let's make sure that this template also gets served.
So in the views.py file, here in the review function,
I'll return render and I accept my request here
and pass that to render and then point at the template
which I wanna render, which is reviews/review.html,
so this template, which we just worked on
and then save this file.
And now with that we're almost ready to start our server.
First, I just wanna go to my settings.py file
and in there, I wanna add my app, my reviews app,
so that Django will find the template here.
That is important otherwise this app template
will not be discovered by Django and this crashes
because this should be path here, not include.
So path in the urls.py file in the main feedback folder.
Path and then only use include here.
Oversight from my side, with that fixed,
now I can start that development server.
And if we now visit localhost:8000
we get this very basic form here.
Now it's lacking all styling, but it is a form.
It also has this sent button and now watch the URL
and see what happens if I click it.
You see that?
If I click send the URL changes and we got
?username=nothing.
Now, if I enter Max here and I click send
the URL changes to ?username=Max.
So it looks like the data I entered here
is then added to the URL.
So let's now explore whether that is what we want
and let's talk about form submission
and different HTTP methods.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.