Skip to main content

Model Admin extension that utilizes the Wagtail collections

Project description

Collection Model Admin

Installation

pip install wagtail-collectionmodeladmin

Development

Checkout this repo, create a local virtual environment and install dependencies:

pip install -e .

Create a new demo wagtail project:

wagtail start demo

We will use the home app as the base for our demo. Add a new Model in demo/home/models.py:

from django.db import models

from wagtail.core.models import CollectionMember


class Demo(CollectionMember, models.Model):
    demo_field = models.CharField()

Add the wagtail.contrib.modeladmin to the demo INSTALLED_APPS at demo/demo/settings/base.py:

INSTALLED_APPS = [
   ...
   'wagtail.contrib.modeladmin',
]

Create the wagtail hooks that will inject the model admin in demo/home/wagtail_hooks.py:

from wagtail.contrib.modeladmin.options import modeladmin_register

from collectionmodeladmin.base import CollectionModelAdmin
from home.models import Demo


class DemoModelAdmin(CollectionModelAdmin):
    model = Demo


modeladmin_register(DemoModelAdmin)

Then as usual make migrations, apply them, create a superuser and start the Django server.

cd demo
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

python manage.py runserver

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-collectionmodeladmin, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size wagtail_collectionmodeladmin-0.1.4-py3-none-any.whl (10.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size wagtail-collectionmodeladmin-0.1.4.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page