How to Add a New Wagtail CMS Page From Scratch

  Рет қаралды 22,475

Coding For Everybody

Coding For Everybody

Күн бұрын

In this video we're going to explore how to add a new app to our Wagtail CMS website, how to install it, and how to add the custom page model. We'll be creating a brand new Wagtail Page from scratch.
Full tutorial is available at learnwagtail.com/tutorials/ho...
The commit for this lesson is available at github.com/CodingForEverybody...
Learn Wagtail from scratch with the official Wagtail for Beginners Course
learnwagtail.com/wagtail-for-...
Used in this video: Wagtail 2.4, Python 3.7, Django 2.1.5 #Wagtail #Django #Python

Пікірлер: 31
@juanmonster6232
@juanmonster6232 2 жыл бұрын
This series is underated..... All I have to say is we need more teachers like you in the classroom.......
@leondaz7380
@leondaz7380 4 жыл бұрын
One of the channels that I disabled my adblocker for. I can't really thank you enough for what you're doing but I can ensure you this is very appreciated. Thank you man.
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
Wow that's fantastic to hear! Glad you're enjoying the vids :)
@TobiasLemke
@TobiasLemke 3 жыл бұрын
Thanks for these amazing tutorials!
@SeanCotton
@SeanCotton 5 жыл бұрын
Another great tutorial, thanks!! I kept wondering why your Django Debug Toolbar was in a different position than mine and then I figured out that you could move it... LOL! learning many new things every day on this journey.
@CodingForEverybody
@CodingForEverybody 5 жыл бұрын
Haha yeah. Debug toolbar was the first thing that helped me understand Django and Wagtail -- its profiling is really nice. There's a bunch of "silent" features in there too. :P
@sailendrachettri966
@sailendrachettri966 3 жыл бұрын
Thank You Sir..!!
@gideonyeboahasante8886
@gideonyeboahasante8886 3 жыл бұрын
Thanks for the amazing tutorials really appreciate it. But in this tutorial looks like we're creating an entire app just to add a page. Is it possible to add the FlexPage model to the models.py in the home directory?. Thanks once again
@Waggy323
@Waggy323 4 жыл бұрын
Thanks for the great tutorials! What VS Code extension is used for highlighting un imported modules with the red scribly lines? Thanks
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
I'm just using the Python extension. It'll try to autodetect a virtual environment like venv or Pipenv and work out the imports from there.
@AyazAmlani
@AyazAmlani 5 жыл бұрын
Great tutorials. Curious though as to why you placed your flex templates under my site instead of keeping the same naming conventions as your home -> templates-> home-> home_page.html. I guess I'll find out the answer throughout this series lol.
@CodingForEverybody
@CodingForEverybody 5 жыл бұрын
That's a good question. It's a convention I like to stick with, and Django will look in both places for the templates. I just like all my templates in one spot so they're easier to find. But really, it's just a preference thing.
@SaintTheDreamer
@SaintTheDreamer 4 жыл бұрын
@@CodingForEverybody I disagree, the resolution order for the templates is first the app > templates folder and then the pages inside project > templates folder. There are cases when you would use either locations depending on your business requirements. Great tutorial !
@morenoh149
@morenoh149 4 жыл бұрын
2nd that, I base my stuff on the Mozilla tut github.com/mdn/django-locallibrary-tutorial/tree/master/catalog and they scope the templates per app.
@bambanx
@bambanx 4 жыл бұрын
Hello, what if this model have a richtextfield with a large text, and i want use part of this text on the home page ? how i can import to the template and limit the amount of text ? its very common on home page have eg: about us text .... and read more. .. . Thanks you
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
Generally speaking you'd have a different field on the Home Page for a short TextField or custom RichTextField. But you can get the RichTextField in the HomePage.get_context() method, convert it using the richtext template tag, and use Djangos Truncate Words filter in your template docs.djangoproject.com/en/2.2/ref/templates/builtins/#truncatewords-html
@bambanx
@bambanx 4 жыл бұрын
​@@CodingForEverybody not sure if i explained me well above :D , but i figure how to do what i want using get_context, for show my text in different pages.
@ucsd007
@ucsd007 4 жыл бұрын
Hey, I have a question about subtitles. Are they necessary for any reason? I feel like the page flows better if I customize it via the title and text block. I've removed it from the page structure but wonder if there is a hidden purpose to it like search functionality?
@ucsd007
@ucsd007 4 жыл бұрын
Great series btw!
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
Nope, the subtitle field was just an example. You can add it to your search index if you want but I never do. Lately I've been using the standard title field on the page, and using get_admin_title() to change it on the admin. And a subtitle is just extra context for what the page is about.
@ucsd007
@ucsd007 4 жыл бұрын
@@CodingForEverybody Thanks for the reply. I'm still getting used to Wagtail and there is a lot to learn!
@joaogoncalves4525
@joaogoncalves4525 2 жыл бұрын
hey it always gives me this error 'NoneType' object has no attribute '_inc_path' can anyone help me?
@morenoh149
@morenoh149 4 жыл бұрын
is there a way to access the model's title field? I named my child page "FAQ" and would like to do "self.title" to read out "FAQ"
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
If you mean in your template, you can write {{ self.title }} or {{ page.title }} (they do the same thing on the page template file). For a child page you'll need to pull the child page into the parent page's get_context() method and add it to your context. There's a video on this one already :)
@morenoh149
@morenoh149 4 жыл бұрын
@@CodingForEverybody I'll have to watch the whole series
@Joker5710
@Joker5710 4 жыл бұрын
I'm getting a 404 at 10:10 I can't get to the live about page. Running: - Python 3.7.5 - Django 3.0.3 - wagtail 2.8 Great tutorial btw! Any help would be greatly appreciated :)
@CodingForEverybody
@CodingForEverybody 4 жыл бұрын
Are you simply getting a "Template does not exist" error? If so, check where you saved flex_page.html - Django can't find it. If you're getting a proper 404 like the page doesn't exist, make sure you've created a new page in your Wagtail Admin with the slug of "about". And it's always a good practice to stop your server and re-run it just to make sure things are loading the way you expect. A case in point is Template tags - they dont get live reloaded during development in most cases.
@wstam88
@wstam88 4 жыл бұрын
Also be sure to create the page as a 'child page' of Home instead of another root page.
@clanzu2
@clanzu2 4 жыл бұрын
advises helped ?
@clanzu2
@clanzu2 4 жыл бұрын
@@wstam88 Thanks
@van3787
@van3787 3 жыл бұрын
it might be a little late for you but it might help others. Changing "template" to "templates" in flex\models.py resolved the problem for me.
How to Add a Basic StreamField to your Wagtail CMS Page
19:34
Coding For Everybody
Рет қаралды 26 М.
Wagtail: The Only CMS I Still Love After Years
49:34
CMS Philly, formerly Drupaldelphia
Рет қаралды 4,4 М.
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 62 МЛН
The joker's house has been invaded by a pseudo-human#joker #shorts
00:39
Untitled Joker
Рет қаралды 10 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 88 МЛН
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 7 МЛН
How to Use ListBlocks in Wagtail CMS to Create Repeating StreamField Content
19:52
Web Server Concepts and Examples
19:40
WebConcepts
Рет қаралды 230 М.
Tutorial: Headless Wagtail on Google Cloud
26:45
Wagtail
Рет қаралды 161
Getting Started With Your First Home Page in Wagtail CMS
16:31
Coding For Everybody
Рет қаралды 65 М.
How to use Orderables in Wagtail CMS
22:42
Coding For Everybody
Рет қаралды 14 М.
How to Add a RichText StreamField to your Wagtail CMS Page
12:09
Coding For Everybody
Рет қаралды 13 М.
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 62 МЛН