The Campaign class provides the underlying logic and metadata common to all email campaigns we might create. Naturally, Birdsong provides a model we extend called Campaign, much like extending Django’s Model class or Wagtail’s Page class. #MJML FORMS SERIES#This slight detour will help us understand how Birdsong works.Ī campaign is an email (or a series of emails) sent to your audience to achieve a specific goal in email marketing. Perfect, now let’s see how we can create our Newsletter model using Birdsong.īefore we jump straight into the code, let’s cover the concept of a campaign in email marketing. With the newsletter app created, we need to add it to our installed apps. Let’s create a new app for the newsletter. In the next section, we will create the Newsletter model. python manage.py migrateĮxcellent, we have finished configuring our project to use Birdsong. We will explore these models later throughout this tutorial. Since Birdsong comes with a few built-in models, we need to partition the database. Perfect, we have finished installing Birdsong and its dependencies. MJML_EXEC_CMD = './node_modules/.bin/mjml' Inside your project’s base settings file, add: #myproject/settings/base.py Let’s tell django-mjml where to find mjml. This processing is what mjml does through its command-line interface, which django-mjml executes to process our templates. Since email providers like Gmail, YahooMail, etc., can’t process mjml templates, we must first convert them to standard HTML. Mjml lives inside your node_modules under the bin folder. yarn add mjmlĪfter installing mjml, you should see a node_modules folder in your project folder at the same level as your Django/Wagtail apps. #MJML FORMS INSTALL#So, let’s install mjml now using yarn or npm if you prefer. Rather it enables Django’s templates to use mjml markup. You might think we’re finished installing everything however, Django-mjml doesn’t install mjml. As you probably guessed, django-mjml is a package that allows us to use mjml markup inside our Django templates and processes them through mjml. It abstracts away a lot of the tedious details of email templates for us. So what’s that mjml (django-mjml) package? Mjml is a markup language created by the mailjet team to make coding responsive emails a breeze. Once pipenv finishes installing Birdsong and django-mjml, we need to add them to our installed apps inside the project’s base settings file. pipenv install wagtail-birdsong django-mjml I prefer to use pipenv to manage my dependencies, but pip works perfectly fine as well-either one gets the job done. Let’s dive in and get started! Installing and Configuring Birdsongįirst, we need to install wagtail-birdsong or simply Birdsong, as I will refer to it from here and its dependencies. The Wagtail team even manages a list of all the excellent packages that you could use. I highly encourage checking it out and contributing to your favorite package. People within the Wagtail community have created an excellent package called wagtail-birdsong that gives a nice foundation from which to build.Īs you may have noticed from the last few tutorials, Wagtail has an active and vibrant community. Thankfully, we won’t have to build the newsletter functionality from scratch. #MJML FORMS CODE#The code is available for download from my Github repository wagtail-devportfolio. Throughout this tutorial, we will add an email newsletter to the Wagtail blog created in the series “ Create a Developer Portfolio with Wagtail“. Adding an email newsletter to your Wagtail blog is an excellent way for you and your followers to stay connected.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |