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
English
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 start working with that data.
And for that, I'll start with the authors
and add a new author.
And I'll add myself here, Maximilian,
Schwarzmuller.
And we got this built in validation, which we saw before.
So if I try to save this here I get an error
is because email address is required,
and here it's also validating if that is an email address
and it tells me if it's not,
because I did set this special field type here,
for post, for author email address has this email field,
that's why we get this email address validation.
But now if I do add some dummy email address here,
I can save this author.
Now I'm not too happy with the output of the author here.
So of course you learn how you can tweak this.
You can override this underscore underscore str,
method here, in the author model or in all models.
And this allows you to change,
how it's represented as a string.
How objects based on that model are represented as a string.
And here we could return first name and last them combined,
and we can again create such a helper method,
as I all did it before in one of the core sections,
we can add a full name,
method here,
where I returned an F string,
where I have self first name, widespace,
self, last name, and then the str method,
we just return the result of calling
self dot full name,
like this.
That's something we can and that is something we did before
in this course as well.
Now, if I save this and reload here,
I have this nicer presentation.
I also wanna work on my posts and I wanna add a new post.
But before we do that,
I want to add a couple of tags to work with.
So here in tags, I will add a,
featured
tag and save this, and add another new tag,
where I say new and save and add another,
and add a hot tag. So that now I got three tags.
And again, I'm not really happy
with how this is represented here?
So of course we can also go to the tag model
and override this str,
special
method here,
to make sure that we return self-taught caption.
So simply the caption stored in the tag
as a string representation for the overall model object.
So now if you reload, we see this.
Now let's work on the posts,
and of course there will face a similar problem
with how it's presented,
but here I'll not add the str method, but instead there,
I later want to tweak our admin panel a little bit
as we all learned it early in the course.
But first of all, let's add a post here
and let's give it a title.
And for this all simply copy one
of my dummy posts titles I created before.
So the data which we have in views.py.
I'll take mountain hiking as a title, and as an excerpt,
I'll take this text here, let's see if it's too long,
maybe we can use it.
As an image name I'll pick this image name
which I used before,
like this.
And as a slug,
it would be nice if that would be auto populated
and that's there also something we'll add soon.
For the moment, I'll manually write it
and copy that slug which I used before.
Now for the content, I wanna to take this content
which I have here, this dummy text
and add to this here.
And whilst I'm here, I'll fix the line breaks,
so that there are some line breaks,
but I don't have this strange indentation.
So,
make it like this,
remove this and just copy this one more time
and get rid of all those paragraphs down there.
So that I have this text here,
and then as an author, I'll assign myself,
and I'll make this featured and hot,
and you can select multiple values here
by holding down command on Mac iOS or control on windows.
And then let's click save here.
So now this post was saved.
Now I will add a second post immediately,
and again, steal my data from here.
Programming is great, and insert this here,
and add this excerpt,
like this. and of course also insert the image name
which I used here, which is this one.
And at the slug, it's still not automatically created
So I'll temporarily still add it myself.
And for the content, I again will use this dummy content,
copy this text, paste it in there,
get rid of the line breaks or these strange indentations
and just repeat this here.
And again, I'll also select myself again,
since I'm the only author and make this new.
We could assign more tags,
but I'll just assign one tag here.
Now we have two posts and we can add a third post,
but before we do that, I wanna tweak the admin panel.
I wanna make sure that here we got multiple columns,
that we can filter here on the right.
And I also want to make sure that when we edit a post,
the slug is auto populated.
And these of course are all things we already did before.
I just want to implement them again
so that we again see them in action.
And we practiced what we learned.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.