Django Tutorial #13 - Extending Templates

  Рет қаралды 80,517

Net Ninja

Net Ninja

Күн бұрын

Пікірлер
@popdaniele4629
@popdaniele4629 4 жыл бұрын
Guys, be careful, in Python3 is a little different. for example: {% load static from staticfiles%} becomes {% load static%} Small differences that can drive you crazy. However fantastic tutorial
@unabonger777
@unabonger777 4 жыл бұрын
I think you mean Django 3
@Anom21
@Anom21 4 жыл бұрын
yeah I learned it the hard way lol
@mudassiransari8519
@mudassiransari8519 3 жыл бұрын
Thank you, bro!
@mysskingopi6143
@mysskingopi6143 3 жыл бұрын
This block content was not work in Python 3 what to do?
@fireberrywocky
@fireberrywocky 5 жыл бұрын
Omw!! Literally, thank God for you!! I was ready to cry before I stumbled on your page! I felt so dumb before! Maybe other people were just giving dumb explanations, cause everything seems so much easier now!
@NetNinja
@NetNinja 5 жыл бұрын
Awesome, glad you liked :)
@-r0l1n95
@-r0l1n95 3 жыл бұрын
THANK YOU! I have been confused about this topic all day trying to find videos explaining it but your video cleared it all up for me thanks!
@aakashjha708
@aakashjha708 7 жыл бұрын
As always, short, precise and well explained !
@JollyAZ
@JollyAZ 4 жыл бұрын
It is criminal this only has 37k views. Idk how u could have made this any easier to understand
@setkyarwalar
@setkyarwalar 7 жыл бұрын
Thanks. I decide to work on my personal project with Django, after I watch your tutorials. Keep up the good work :)
@CAONST_DEV
@CAONST_DEV 2 жыл бұрын
this version Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. {% load static %} and layout.html in from app/templates , This is Ok?
@tz7383
@tz7383 4 жыл бұрын
Hi, nice video! I was wondering how could you perform 'template extends' in two steps? extend template 1 into template 2, followed by extend template 2 into template 3??
@mrvanhoyte
@mrvanhoyte Жыл бұрын
Question, how would you add tags to the head from the template because I tried and like my base description keeps over riding my template tags or it keeps taking the image on my nav and ignoring what I set as the image
@funwithpython883
@funwithpython883 3 жыл бұрын
Thanks man, you saved me, keep up the good job.
@panagiotisgoulas8539
@panagiotisgoulas8539 4 жыл бұрын
Hey I have a question. How do I do partial template inheritance? My problem is I have a base template that many of my templates inherit from and it has a container with 2 columns, col-md-8 and col-md-4. On the col-md-8 column part of the container is where the {% block content %} lives and on the other one the col-md-4 is my sidebar. Now when I use my registration form since it inherits from base template I have a col-md-8 form but I don't want to see sidebar when I register... Anyone any ideas?
@Kristmaz808
@Kristmaz808 6 жыл бұрын
this concept just blew my mind....
@linkymcfinkelstein6763
@linkymcfinkelstein6763 4 жыл бұрын
This was exactly what I was looking for! Thank you for saving my time, next time I subscribe.
@prasadkadu9737
@prasadkadu9737 5 жыл бұрын
i cant get my backgroung image from styles.css file ??
@nikhilkumar5412
@nikhilkumar5412 4 жыл бұрын
How do I change the title of other html files since is present in the base_layout. Html??
@elyasomarr
@elyasomarr 4 жыл бұрын
That's great but I have a question how should we fix the title tag as they will not be same for every template?
@elyasomarr
@elyasomarr 4 жыл бұрын
Founf it from stackoverflow Django display a page title based on a variable stored in a view Views.py def sport_landing(request): page_title = 'Sport' cat_landing = Article.objects.filter(status='published', category='sport', published_date__lte=timezone.now() ).order_by('-published_date') return render(request, "categorylanding.html", {'cat_landing': cat_landing, 'page_title':page_title } Template {% extends 'base.html' %} {% load humanize %} {% block content %} {{ page_title }}
@kouyajia496
@kouyajia496 7 жыл бұрын
Hello Ninja, will you show us how to deploy the website using mod-wsgi? Really looking forward, thanks.
@zarakikenpachi1238
@zarakikenpachi1238 4 жыл бұрын
Thank you a lot :) Did you think that learing python django, are good idea :) because i see, that c++ and is the most searching langage ? if you could help me
@altair6616
@altair6616 6 жыл бұрын
can i have more than 1 block content in the base layout and how tho manage them if i can ?
@hamamathivha6055
@hamamathivha6055 6 жыл бұрын
You're an awesome teacher bro : )
@algoholic-pro
@algoholic-pro 5 жыл бұрын
Thank you,It was a much required concept
@brickandorder
@brickandorder 6 жыл бұрын
I'm kinda frustrated here.. I have some code for extends from 'blog/header'' {% extends 'blog/header.html' %} {% block content %} Hey, welcome to my website! I am a programmer. (% endblock %} That is the home.html file. I get an error that reads from the development site: Unclosed tag on line 3: 'block'. Looking for one of: endblock. Specifically this is an error during rendering. I don't have any guess to what could be wrong with my render processing for this.
@brickandorder
@brickandorder 6 жыл бұрын
Redundant and template information: Aaron Acosta {% block content %} {% endblock %}
@annaburshtyko5714
@annaburshtyko5714 4 жыл бұрын
Thanks a lot!! Very useful tutorial!
@zachbamberger8932
@zachbamberger8932 7 жыл бұрын
I am running into an error when trying to run with this extension, {% extends 'base_layout.html' %} Error during template rendering. Going through the stack trace it appears it cannot find the layout. I am confident everything is correctly placed and correctly named...
@guywithwings2002
@guywithwings2002 6 жыл бұрын
Hey so at this point you probably moved on, but I had a similar issue and after looking into the settings.py file realized that i forgot to set 'templates' as a DIRS (which is necessary in telling Django that the templates folder exists). change "DIRS: []," to "DIRS: ['templates'],". Sorry for being late on ball!
@saipavanmeruga709
@saipavanmeruga709 5 жыл бұрын
@@guywithwings2002 Hey can you help with the template not found error I have added the code "DIRS: ['templates']" still the error exists i dont know why
@harshitjain7673
@harshitjain7673 5 жыл бұрын
@@saipavanmeruga709 Instead of that make it 'DIRS': [ os.path.join(BASE_DIR, 'templates'), ], this worked for me
@manuelamolong8468
@manuelamolong8468 2 жыл бұрын
very helpful 👍
@SMA5HPL
@SMA5HPL 7 жыл бұрын
how do you remove the tabs(spaces) before the selected text? :D
@NetNinja
@NetNinja 7 жыл бұрын
:D. In Atom, you highlight the block of code and press shift + tab. It removes the indent of that block. But only when it's a multi-line block. If you highlight just one line of code and try it... poof. Goodbye line of code.
@AboSara20205
@AboSara20205 6 жыл бұрын
Thanks, that was very helpful
@sirajAlam049
@sirajAlam049 6 жыл бұрын
Awesome. Subscribed!!
@vishavbangotra5405
@vishavbangotra5405 4 жыл бұрын
How to extend multiple templates in one?
@yjk22
@yjk22 7 жыл бұрын
How to create realtime chatting system like socket.io using Django?
@REZAsys2
@REZAsys2 4 жыл бұрын
Thanks but there is not code in github
@Standupibrahimbackup
@Standupibrahimbackup 4 жыл бұрын
Bro it might sound very random but are you MrFreeze2244 who made hitman game walkthrough videos?
@NetNinja
@NetNinja 4 жыл бұрын
Hey no, not me 🙂
@viswanadhgounipalli2889
@viswanadhgounipalli2889 6 жыл бұрын
thank you so much and very help full to me
@Lbmaniak
@Lbmaniak 6 жыл бұрын
thx I hope, someday I will watch playlist for Django in production :-)
@jamessanders5522
@jamessanders5522 Жыл бұрын
Fantastic tutorial videos, clear and concise explanations on even the tiniest of things 🤝🫶
@NetNinja
@NetNinja Жыл бұрын
Much appreciated! :) thanks for watching
@C137-RickSanchez
@C137-RickSanchez 3 жыл бұрын
thank you sir, i read the docs but i cant understand until watch your video
@KevinTempelx
@KevinTempelx 4 жыл бұрын
Thank you!
@blacksoliderfly
@blacksoliderfly 6 жыл бұрын
u are amazing
@TKDVL
@TKDVL 5 жыл бұрын
The stof hahaha, love that british accent
@learnanywhere5736
@learnanywhere5736 7 жыл бұрын
hi bro i already well know in django i want to know signal listview Templateview formview registration user login and logout upload picture video kindly make tutor following this type of video..
@NetNinja
@NetNinja 7 жыл бұрын
Hey, user registration is coming soon - sign up, login, logout etc - as well as how to upload media :)
@i_am_a_real_cat1443
@i_am_a_real_cat1443 3 жыл бұрын
finally i got it
@Sheetanshkumar
@Sheetanshkumar 5 жыл бұрын
well, you saved me :D
@codejns2275
@codejns2275 6 жыл бұрын
Extend the template but render the new template. Anybody following step by step : do remember to render the new template not the base template.
@Anom21
@Anom21 4 жыл бұрын
I love to eliminate code duplication
@sabyasachisamantaray90
@sabyasachisamantaray90 2 жыл бұрын
Reason Unknown to me: If your block contents ain't working Try renaming the base_layout.html to base.html This worked for me. Would be thankful if anyone explains me the reason
@Govt_Jobb
@Govt_Jobb 4 жыл бұрын
It shows me error (TemplateDoesNotExist at /) Edit: Thank you so much sir, it's worked for me. Liked.
@bountyhunter8132
@bountyhunter8132 4 жыл бұрын
How exactly did you fix the template does not exist problem? I dont know how. Thanks. :)
@Govt_Jobb
@Govt_Jobb 4 жыл бұрын
@@bountyhunter8132 Actually i was trying to extend a base file, and because of wrong path, it show *(TemplateDoesNotExist at /)* this error. Wrong path: {% extends 'base.html' %} Correct path: {% extends 'blog/base.html' %} You can check if there is any name error.
@bountyhunter8132
@bountyhunter8132 4 жыл бұрын
@@Govt_Jobb Sorry i found out like five min after asking you. I wonder how he did it because his was in the main templates file. I had to put it in the articles template.
@faisalhossain2002
@faisalhossain2002 4 жыл бұрын
goto setting.py -> TEMPLATES-> DIRS['templates',],
@faisalhossain2002
@faisalhossain2002 4 жыл бұрын
if still same problem.may be you templeates dir not in BASE_DIR
@DuongTran-zh6td
@DuongTran-zh6td 2 жыл бұрын
tao block content va them block content vao html base
@mahmudulhasan-vu2hg
@mahmudulhasan-vu2hg Жыл бұрын
is this relevant today?
Django Tutorial #14 - URL Parameters
8:11
Net Ninja
Рет қаралды 67 М.
Django Tutorial #17 - Uploading Media
11:52
Net Ninja
Рет қаралды 72 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Django Apps, Views and Templates (A Beginners look)
17:18
CodingWithMitch
Рет қаралды 63 М.
Django Tutorial - Templates & Custom HTML
27:52
Tech With Tim
Рет қаралды 115 М.
Django and htmx Tutorial: Easier Web Development
1:05:52
PyCharm, a JetBrains IDE
Рет қаралды 26 М.
Django Tutorial for Beginners - Build Powerful Backends
1:02:36
Programming with Mosh
Рет қаралды 2,8 МЛН
Django Tutorial #15 - Named URL's
8:13
Net Ninja
Рет қаралды 44 М.
Django Tutorial #10 - Template Tags
8:11
Net Ninja
Рет қаралды 74 М.
Django Tutorial #5 - Django Apps
15:20
Net Ninja
Рет қаралды 107 М.
Extends Base.html For Navbars - Python Django Dentist Website #8
17:35
Django Base Template | Django Project | djblogger | 23
13:19
Very Academy
Рет қаралды 15 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН