Mezzanine Page Auth is a Mezzanine module for adding group-level permissions to Pages.
A fork of Mezzanine_Page_Auth
This repository contains fixes to make mezzanine_page_auth compatible with more modern versions of Mezzanine and Django.
This fork has been tested on... - Mezzanine 4.3.1 - Django 1.11.17 - Python 2.7.15
Install from HEAD of this repository:
$ pip install git+https://github.com/rykerls/mezzanine_page_auth.git#egg=mezzanine_page_auth
Add mezzanine_page_auth
to your INSTALLED_APPS
setting before all mezzanine apps:
INSTALLED_APPS = (
# ...
'mezzanine_page_auth',
'mezzanine.boot',
'mezzanine.conf',
'mezzanine.core',
# ...
)
You will then want to create the necessary tables.:
$ python manage.py migrate mezzanine_page_auth
Enable PageAuthMiddleware
middleware in your settings module as follows:
MIDDLEWARE_CLASSES = (
# ...
"mezzanine.core.middleware..."
"mezzanine.pages.middleware..."
"mezzanine_page_auth.middleware.PageAuthMiddleware",
# ...
)
The order of MIDDLEWARE_CLASSES
is important. You should include the PageAuthMiddleware
middleware after other Mezzanine middlewares in the list.
Enable page_auth
template context processors in your settings module as follows:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
os.path.join(PROJECT_ROOT, "templates")
],
"OPTIONS": {
"context_processors": [
#...
"mezzanine_page_auth.context_processors.page_auth",
]
]
Add mezzanine_page_auth.context_processors.page_auth
to the end of the context_processors
list.
Configure EXTRA_MODEL_FIELDS
Mezzanine setting in your settings module as follows:
EXTRA_MODEL_FIELDS = (
# ...
(
"mezzanine.pages.models.Page.groups",
"ManyToManyField",
("auth.Group",),
{"blank": True, "null": True, "verbose_name": 'groups',
'symmetrical': False, 'through': "mezzanine_page_auth.PageAuthGroup"},
),
# ...
)
for inject field groups
into Mezzanine’s models (reference to Field Injection Mezzanine documantation).
Mezzanine Page Auth is BSD licensed.