Sidebar with Custom Template Tags - Building a web app with Django - Part 17

  Рет қаралды 1,782

Andreas Jud

Andreas Jud

Күн бұрын

Пікірлер: 18
@ajudmeister
@ajudmeister Жыл бұрын
🐞Bug Alert!! The first Comment for a Post doesn't show up!! - In Part 12 I implemented an if statement to hide the tabs on the Post page: kzbin.info/www/bejne/imatl5WVgdCijJIsi=nJfUCHD-hekaBpr2&t=1118 - this does not work together with htmx! I give an explanation and solution here: kzbin.info/www/bejne/onTdqqKefquobKcsi=BJL604HbNfUSpMIE&t=1835.
@yashinshekh802
@yashinshekh802 Жыл бұрын
loved your content. as a django developer i really hate switching to frontend framework. this seemed to be the perfect solution. keep this coming. love from nepal
@ajudmeister
@ajudmeister Жыл бұрын
Thanks a lot! Yea Django gives you already such a good frontend system with the templates, and if you use htmx you don't need to add an additional highly complex framework on top of it anymore to achieve interactivity.
@enkiimuto1041
@enkiimuto1041 Жыл бұрын
You are amazing mate
@TomislavMiletic
@TomislavMiletic Жыл бұрын
This approach is great, but can you please explain how does it differ from using context_processors?
@ajudmeister
@ajudmeister Жыл бұрын
To be honest I haven't worked with context processors yet, but both of those approaches work. Template tags are specific to a template, so in my case I want to show the sidebar only with one specific layout (the a layout), in this case template tags work better in my opinion. Context processors attach data to all the requests, so it's available globally. They make sense when this data is used across multiple templates and views. They also require adding additional settings to the settings.py file, which I want to avoid in order to keep the file focused on the most critical configurations.
@sandamichael19
@sandamichael19 11 ай бұрын
Hi, I love your work here. Can you tell me how you can limit number of posts/comments displayed in the sidebar?
@ajudmeister
@ajudmeister 11 ай бұрын
Hi, just add [:5] to the end of query if you want to display just 5 posts. Full line: top_posts = Post.objects.annotate(num_likes=Count('likes')).filter(num_likes__gt=0).order_by('-num_likes')[:5]
@Armin-q6p
@Armin-q6p Жыл бұрын
First to comment, continue your good work Bro
@ajudmeister
@ajudmeister Жыл бұрын
Thanks, will do!
@nicenaija9952
@nicenaija9952 Жыл бұрын
Do a tutorial on huey or django-q
@ajudmeister
@ajudmeister Жыл бұрын
hey, what features on a website would you like to see using this packages?
@nicenaija9952
@nicenaija9952 Жыл бұрын
@@ajudmeister notifications? Checking for top daily updates, news as emails , marketing emails etc
@ajudmeister
@ajudmeister Жыл бұрын
@@nicenaija9952 Thanks for the suggestions. I might come back to this later.
@icezzzWZ
@icezzzWZ Жыл бұрын
Hey Andreas. I got a question. We made a rule that no authorized users can not comment, right? So there is no need to put in top comments a new if to write no author, isn't there?
@ajudmeister
@ajudmeister Жыл бұрын
That's right you need to be authenticated to comment, but I put it in for the case that the author deletes his account, in this case the comment will not be delete because in our Comment Model we have on_delete=models.SET_NULL on the author property. So the comment will have no author assigned to it.
@icezzzWZ
@icezzzWZ Жыл бұрын
Perfect! You'd thought in all details. Thanks for the explanation.@@ajudmeister
Profile Tabs with Htmx - Building a web app with Django - Part 18
33:29
How to build a web app in python. Complete roadmap and learning materials...
11:17
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Django Tutorial #10 - Template Tags
8:11
Net Ninja
Рет қаралды 74 М.
Bootstrap 5 RESPONSIVE Sidebar / Vertical Navigation
15:44
A Designer Who Codes
Рет қаралды 17 М.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
developedbyed
Рет қаралды 986 М.
Django Tutorial - Templates & Custom HTML
27:52
Tech With Tim
Рет қаралды 114 М.
Django Bootstrap Navbar | Django Project | djblogger | 25
10:50
Very Academy
Рет қаралды 10 М.
Tenants with Django, Intro - Part 1
19:40
Andreas Jud
Рет қаралды 4,5 М.
Build A Website With Django 4.0! - Django Wednesdays #46
20:43
Codemy.com
Рет қаралды 30 М.
How To Limit Lines Of Text With CSS Only
11:53
Web Dev Simplified
Рет қаралды 116 М.
Django Admin Template and CSS Overrides
16:12
Very Academy
Рет қаралды 50 М.