forked from feincms/feincms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
36 lines (28 loc) · 1.29 KB
/
Copy pathadmin.py
File metadata and controls
36 lines (28 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from feincms import ensure_completely_loaded, settings
from .models import Page
from .modeladmins import PageAdmin
try:
from django.core.exceptions import FieldDoesNotExist
except ImportError: # Django<1.8
from django.db.models import FieldDoesNotExist
# ------------------------------------------------------------------------
if settings.FEINCMS_USE_PAGE_ADMIN:
ensure_completely_loaded()
try:
Page._meta.get_field("template_key")
except FieldDoesNotExist:
raise ImproperlyConfigured(
"The page module requires a 'Page.register_templates()' call "
"somewhere ('Page.register_regions()' is not sufficient). "
"If you're not using the default Page admin, maybe try "
"FEINCMS_USE_PAGE_ADMIN=False to avoid this warning."
)
admin.site.register(Page, PageAdmin)
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------