What’s It Like For A Developer Moving To Wagtail From Drupal?

Drupal 8 and Wagtail logos
  • Wagtail has a community you can easily get involved in.
  • For developers, Wagtail is a great tool to add to your toolbox for creating web applications but also, learning Python is a whole new toolbox because It’s used across a range of industries, not just web development. This is really positive for your career as a developer
  • The list of organisations worldwide who have independently selected Wagtail for major projects is pretty impressive, and it’s quickly growing. Google, Nasa, and Oxfam to name a few.

PHP to Python 🐍

Wagtail (Django) Apps are like Drupal Modules

A Good Editor 📝

Starting a site

Working on a project 📝

Structurally Awesome

node--standard-page.html.twig  # Drupal
standard_page.html # Wagtail

Stop Building Content Types And Start Developing Apps

Adding a content type with one field
Drupal Blog listing view
  1. Run python manage.py startapp blog
  2. Add the new blog app to INSTALLED_APPS in mysite/settings/base.py.
  3. Write your model with fields for date, intro and body:
  • class BlogPage(Page) The blog post content type including fields that should be indexed for search.
  • class BlogIndexPage(Page) The Blog listing view page

Publishers Publish, Developers Develop.

Debugging 🐛

from pudb import set_trace; set_trace()
Pudb debugging
Django Debug Toolbar

EntityQuery vs QuerySet API 🔎

$query = \Drupal::entityQuery('node');  
$query->condition('status', 1);
$query->condition('type', 'blog');
$entity_ids = $query->execute();
// Do something with $entity IDs, like load multiple...
blog_posts = BlogPage.objects.live().order_by('title')
from django.db.models import Q...
events = EventPage.objects.live().order_by('title')
events = events.filter(Q(event_date__range([start_date, end_date])) | Q(event_is_daily=True))

Translation t() vs _ 🌐

from django.utils.translation import ugettext_lazy as _
...
label=_("Translate me!"),

Signals, Hooks, and EventSubscribers 📢

from wagtail.core import hooks

@hooks.register('name_of_hook')
def my_hook_function(arg1, arg2...)
# your code here

In Summary ☀️ Was Moving to Wagtail A Good Idea?

--

--

--

Developer, I also make art and listen to techno https://www.kevinhowbrook.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Clean Code, why do we need them

How to find users using Data Loader in Salesforce?

Librosa: A Python Audio Libary

Cheatsheet for NumPy: Essential and Lesser-Known Functions

Numpy python

Unity — Fight or Flight

Generate Combinations on Rosetta Code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevin howbrook

Kevin howbrook

Developer, I also make art and listen to techno https://www.kevinhowbrook.com/

More from Medium

Learn Python From Scratch As a Frontend Developer

PY to JS [ 0 ] : Print  , Variable types and declaration ,

From Low Code to Django+React.js

A screen with source code

Create a Stack Class in Python