Wagtail CMS: Registering Snippets (Blog Category) using Checkboxes

  Рет қаралды 7,142

Coding For Everybody

Coding For Everybody

Күн бұрын

Пікірлер: 12
@hamednajand8327
@hamednajand8327 4 жыл бұрын
You're awesome! the way you teach is the one way that I'm exciting to follow and in fact, I don't sleep during the video :))
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
(▀Ĺ̯▀ ̿) Thank you!! :D
@nooralqoj4575
@nooralqoj4575 3 жыл бұрын
Great tutorial and amazing instructor :) I click like button before I watch the videos !!
@CodingForEverybody
@CodingForEverybody 3 жыл бұрын
Amazing! Thank you so much for the support!
@richardallen543
@richardallen543 3 жыл бұрын
Great tutorial, especially working out the filtering by category. Immensely useful :) Probably wouldn't be trusting content editors to make slugs though 😂 I went with the autoslug field from django extensions: from django_extensions.db.fields import AutoSlugField ... slug = AutoSlugField( populate_from=['name'], verbose_name='slug', allow_unicode=True, max_length=200, ) then drop slug from the panel
@IllevensKO
@IllevensKO 4 жыл бұрын
Is there any way to use tag chooser panel style ? Can't find anything about it.
@Cosas1008
@Cosas1008 3 жыл бұрын
filter inspired by Kalob if request.GET.get('category'): context["posts"] = BlogDetailPage.objects.live().public().filter(categories__slug__in=[request.GET.get('category')]) else: context["posts"] = BlogDetailPage.objects.live().public()
@boryskuczkowski
@boryskuczkowski 5 жыл бұрын
@15:45 Have you, eventually, implemented the filter?
@CodingForEverybody
@CodingForEverybody 5 жыл бұрын
Nope I don't believe so. But it'd be as easy as BlogDetailPage.objects.live().public().filter(categories__slug__in=[request.GET.get('category')]), or something along these lines. (Note: that's untested, so you may need to adjust it)
@DouglasMcKey
@DouglasMcKey 4 жыл бұрын
I applied the filter my side, I used this: # Get all the blog posts. posts = BlogDetailPage.objects.live().public() # Identify recent posts and send to template: context["recent_posts"] = posts[:5] # Check if there is a category slug in the URL to filter the blog posts by. category_slug = request.GET.get("category", None) context["blog_posts"] = posts # By default - set to all posts if category_slug: # Must have a count > 0 in order to display something if posts.filter(categories__slug__contains=category_slug).count() > 0: context["blog_posts"] = posts.filter(categories__slug__contains=category_slug) else: context["blog_posts"] = posts # Seems like repetition but it caters for the 0 count on a blog_slug. ** I used the context["recent_posts"] to create a latest 5 posts navigation on the right of my content. Reverse ordered in template. ** I used the context["blog_posts"] to actually filter the blog list view when certain categories were clicked. (Only displayed categories with more than 0 posts associated to them)
@richardallen543
@richardallen543 3 жыл бұрын
@@DouglasMcKey using categories__slug__contains=category_slug doesn't work if the name of the category forms part of the name of other categories. It'll pick up all those categories instead of just the one you want. I tried this with having Education, Early Education, Environmental Education. When I went with ?=Education I got all 3 categories. Just categories__slug=category_slug works fine though.
How to use Orderables in Wagtail CMS
22:42
Coding For Everybody
Рет қаралды 14 М.
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 9 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 6 МЛН
Wagtail CMS: Registering Snippets using Django Models
13:35
Coding For Everybody
Рет қаралды 10 М.
Wagtail CMS: How to Create a Custom Wagtail Menu System
38:22
Coding For Everybody
Рет қаралды 20 М.
We can now transition to and from display: none
21:20
Kevin Powell
Рет қаралды 86 М.
Getting Started With Your First Home Page in Wagtail CMS
16:31
Coding For Everybody
Рет қаралды 65 М.
How To Slugify Category Page URLs - Django Blog #14
7:53
Codemy.com
Рет қаралды 33 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 167 М.
PhD AI student explains how China already have won in AI..
13:28
livinlavidaluke
Рет қаралды 53 М.
Wagtail CMS: Routable Page Categories And Years
19:01
Coding For Everybody
Рет қаралды 3,8 М.
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН