Skip to main content

Model choosers for Wagtail admin

Project description

A plugin for Wagtail that provides a ModelChooserPanel and ModelChooserBlock for arbitrary models.


Install using pip:

pip install wagtail-modelchooser

Then add it to your INSTALLED_APPS:

    # ...
    # ...

It works with Wagtail 1.4 and upwards.

Quick start

To enable the chooser for your model, you must register the model. For simple cases, decorate your model with @register_model_chooser:

from django.db import models

from wagtailmodelchooser import register_model_chooser

class Author(models.Model):
    name = models.CharField(max_length=255)

    def __str__(self):
        # The ``str()`` of your model will be used in the chooser

You can then use either ModelChooserPanel in an edit handler definition, or ModelChooserBlock in a StreamField definition:

from wagtail.wagtailcore.blocks import RichTextBlock
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtailmodelchooser.blocks import ModelChooserBlock
from wagtailmodelchooser.edit_handlers import ModelChooserPanel

class Book(Page):
    name = models.CharField(max_length=255)
    author = models.ForeignKey(Author)

    content_panels = [

class ContentPage(Page):
    body = StreamField([
        ('text', RichTextBlock()),
        ('author', ModelChooserBlock('books.Author')),

    content_panels = [

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wagtail-modelchooser-1.13.1, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size wagtail-modelchooser-1.13.1-2.0.0.tar.gz (8.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page