All language subtitles for 009 Configuring the Admin Panel_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,160 --> 00:00:05,550 So how can we tweak the admin panel? 2 00:00:05,550 --> 00:00:07,540 Well, in some aspects, 3 00:00:07,540 --> 00:00:10,910 so when it comes to the individual fields to be precise, 4 00:00:10,910 --> 00:00:13,590 we can typically do that in the models. 5 00:00:13,590 --> 00:00:15,920 There, we have various extra options 6 00:00:15,920 --> 00:00:19,420 which we can set like editable equals false, 7 00:00:19,420 --> 00:00:21,260 which of course I don't wanna set here. 8 00:00:21,260 --> 00:00:23,690 But we got some field specific options 9 00:00:23,690 --> 00:00:27,300 which affect the forum where the field is rendered here 10 00:00:27,300 --> 00:00:30,573 in our model when we work on the fields themselves. 11 00:00:31,760 --> 00:00:34,160 But I'm pretty happy with what we have there. 12 00:00:34,160 --> 00:00:36,050 There are some settings we can add here. 13 00:00:36,050 --> 00:00:37,870 You can always dive in the official docs 14 00:00:37,870 --> 00:00:41,030 to play around with all possible options. 15 00:00:41,030 --> 00:00:44,540 But I wanna set some admin wide settings 16 00:00:44,540 --> 00:00:48,160 to be precise settings which affect this page 17 00:00:48,160 --> 00:00:50,153 where we see all the posts. 18 00:00:51,410 --> 00:00:56,410 And for that go to admin.py and we add a new class here. 19 00:00:57,130 --> 00:01:01,680 We add a post admin clause. 20 00:01:01,680 --> 00:01:03,280 Now this clause name is up to you 21 00:01:03,280 --> 00:01:06,393 but it should extend admin.model admin. 22 00:01:07,530 --> 00:01:11,210 And then in there, we can add a couple of settings. 23 00:01:11,210 --> 00:01:16,190 For example, we can add list filter to add a filter 24 00:01:16,190 --> 00:01:18,130 on this posts page, 25 00:01:18,130 --> 00:01:22,590 and to specify by which fields we should be able to filter. 26 00:01:22,590 --> 00:01:26,350 And I want to be able to filter by author. 27 00:01:26,350 --> 00:01:28,780 That is possible, even though it's a related field, 28 00:01:28,780 --> 00:01:31,170 we can still filter by that. 29 00:01:31,170 --> 00:01:34,760 And I want to be able to filter by date and by tags, 30 00:01:34,760 --> 00:01:35,680 let's say. 31 00:01:35,680 --> 00:01:37,310 These are the three fields 32 00:01:37,310 --> 00:01:39,850 which make the most sense to me here. 33 00:01:39,850 --> 00:01:41,630 Hence we set this to a tuple 34 00:01:41,630 --> 00:01:44,290 where we simply add those field names. 35 00:01:44,290 --> 00:01:48,943 So author, tag, and date, like this. 36 00:01:49,980 --> 00:01:53,860 I also, as I said, want to display a couple of columns here 37 00:01:53,860 --> 00:01:56,670 so that we don't just have these posts objects here 38 00:01:56,670 --> 00:02:01,380 but instead we maybe show the title, the date, the author, 39 00:02:01,380 --> 00:02:02,403 something like this. 40 00:02:03,350 --> 00:02:07,690 Hence, I'll add list display which is the setting for that, 41 00:02:07,690 --> 00:02:12,690 where we then add title, author, 42 00:02:12,940 --> 00:02:16,623 and maybe date as a second value like this. 43 00:02:17,810 --> 00:02:20,240 And as explained earlier in the course, 44 00:02:20,240 --> 00:02:23,840 these field names which you specify here 45 00:02:23,840 --> 00:02:26,980 of course, have to be exactly the same field names 46 00:02:26,980 --> 00:02:28,480 you have in your model clause. 47 00:02:30,090 --> 00:02:31,510 Now, with that, we need to make sure 48 00:02:31,510 --> 00:02:35,250 that we also load this post admin clause so to say, 49 00:02:35,250 --> 00:02:37,270 so when we register posts, 50 00:02:37,270 --> 00:02:40,853 we now pass post admin as a second argument. 51 00:02:42,290 --> 00:02:46,610 And with that, we can save this and get an error 52 00:02:46,610 --> 00:02:50,930 because Django thankfully checks what I set up here. 53 00:02:50,930 --> 00:02:52,520 And I just emphasized that 54 00:02:52,520 --> 00:02:54,920 you have to use the exact same names. 55 00:02:54,920 --> 00:02:59,850 Well, there is no field name tag, it's tags with an S. 56 00:02:59,850 --> 00:03:02,653 So of course, it should be tags here as well. 57 00:03:04,080 --> 00:03:05,100 So now we'll save this, 58 00:03:05,100 --> 00:03:07,990 and thankfully Django has this check. 59 00:03:07,990 --> 00:03:10,870 Now with this saved, if we reload here 60 00:03:10,870 --> 00:03:14,093 we've got these columns and we can filter. 61 00:03:15,750 --> 00:03:17,180 And we can automatically sort 62 00:03:17,180 --> 00:03:19,090 by these columns here, by the way. 63 00:03:19,090 --> 00:03:22,690 And with that, this already looks much nicer, I would say. 64 00:03:22,690 --> 00:03:26,010 Now I also I wanna make sure though that when we add a post, 65 00:03:26,010 --> 00:03:29,090 the slug is filled out automatically. 66 00:03:29,090 --> 00:03:31,270 We can still override it manually then 67 00:03:31,270 --> 00:03:34,950 but it should be pre-populated automatically. 68 00:03:34,950 --> 00:03:38,480 And for this, we can add pre-populated fields. 69 00:03:38,480 --> 00:03:41,030 And this takes a dictionary as a value 70 00:03:41,030 --> 00:03:44,600 where we use the field that should be pre-populated 71 00:03:44,600 --> 00:03:48,870 as a key, so in this case, the slug field, 72 00:03:48,870 --> 00:03:50,970 using that field name here. 73 00:03:50,970 --> 00:03:53,670 And then, as a value, we have a tuple 74 00:03:53,670 --> 00:03:57,550 of all the fields that provides the values 75 00:03:57,550 --> 00:04:00,510 for pre-populating that slug field, 76 00:04:00,510 --> 00:04:02,593 in this case, just the title. 77 00:04:03,580 --> 00:04:05,250 Again, save this. 78 00:04:05,250 --> 00:04:08,520 And now if we reload here, when we add a new post, 79 00:04:08,520 --> 00:04:13,273 if I type here, that slug gets filled out automatically. 80 00:04:14,560 --> 00:04:17,220 And with that, I'll then add my third 81 00:04:17,220 --> 00:04:19,760 and last dummy post here. 82 00:04:19,760 --> 00:04:23,653 Nature at its best, like this. 83 00:04:24,650 --> 00:04:27,520 Add the exert, like this. 84 00:04:31,610 --> 00:04:35,290 Then grab the image name which is woods.jpg 85 00:04:36,300 --> 00:04:38,620 and some content. 86 00:04:38,620 --> 00:04:41,380 And here I'll again, take one paragraph, 87 00:04:41,380 --> 00:04:44,873 add this here and get rid of these indentations. 88 00:04:45,750 --> 00:04:47,610 And then just again, 89 00:04:47,610 --> 00:04:51,533 if you want to repeat this multiple times like that. 90 00:04:52,800 --> 00:04:55,520 And pick an author which again is me, 91 00:04:55,520 --> 00:04:59,783 add a tag or multiple tags and save this. 92 00:05:01,010 --> 00:05:03,860 So now we have all those posts added. 93 00:05:03,860 --> 00:05:06,530 We have all that data added 94 00:05:06,530 --> 00:05:09,860 and we are able to administer this as needed. 95 00:05:09,860 --> 00:05:13,140 Now, I of course wanna make sure that if I go 96 00:05:13,140 --> 00:05:16,860 to local host 8,000 to my blog here, 97 00:05:16,860 --> 00:05:19,050 I no longer load that dummy data 98 00:05:19,050 --> 00:05:23,610 from that all posts list here, but that instead now, 99 00:05:23,610 --> 00:05:26,210 in our views, we query the database 100 00:05:26,210 --> 00:05:28,200 with help of Django's bottles 101 00:05:28,200 --> 00:05:30,510 and we display that model data 102 00:05:30,510 --> 00:05:34,363 so that data coming from the database in our templates. 7998

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.