Tutorial Summary

In the land of Django and Wagtail, sometimes you need custom Django Models but Wagtail doesn't let you edit these models by default. And personally, I don't believe in giving a client 2 admin dashboards to operate in. So let's add a custom Django Model to our Wagtail website using a Wagtail ModelAdmin.

# ...

    # ...
    # ...

# ...
# subscribers/admin.py
from wagtail.contrib.modeladmin.options import (
from .models import Subscribers

class SubscriberAdmin(ModelAdmin):
    """Subscriber admin."""

    model = Subscribers
    menu_label = "Susbcribers"
    menu_icon = "placeholder"
    menu_order = 290
    add_to_settings_menu = False
    exclude_from_explorer = False
    list_display = ("email", "full_name",)
    search_fields = ("email", "full_name",)

# subscribers/models.py
from django.db import models

class Subscribers(models.Model):
    """A subscriber model."""

    email = models.CharField(max_length=100, blank=False, null=False, help_text='Email address')
    full_name = models.CharField(max_length=100, blank=False, null=False, help_text='First and last name')

    def __str__(self):
        """Str repr of this object."""
        return self.full_name

    class Meta:  # noqa
        verbose_name = "Susbcriber"
        verbose_name_plural = "Subscribers"
Sign up for our newsletter

Get notified about new lessons :)

Our Sites