
from __future__ import absolute_import

from django.contrib import admin

from .models import Page
from .modeladmins import PageAdmin

# ------------------------------------------------------------------------
admin.site.register(Page, PageAdmin)

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------


from __future__ import absolute_import

from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.db.models import FieldDoesNotExist

from .models import Page
from .modeladmins import PageAdmin

# ------------------------------------------------------------------------
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).')

admin.site.register(Page, PageAdmin)

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------

Abort when the page model does not have a template_key field
Abort when the page model does not have a template_key field

  
  from __future__ import absolute_import
  
  from django.contrib import admin
+ from django.core.exceptions import ImproperlyConfigured
+ from django.db.models import FieldDoesNotExist
  
  from .models import Page
  from .modeladmins import PageAdmin
  
  # ------------------------------------------------------------------------
+ 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).')
+ 
  admin.site.register(Page, PageAdmin)
  
  # ------------------------------------------------------------------------
  # ------------------------------------------------------------------------
  
Abort when the page model does not have a template_key field
## Code Before:

from __future__ import absolute_import

from django.contrib import admin

from .models import Page
from .modeladmins import PageAdmin

# ------------------------------------------------------------------------
admin.site.register(Page, PageAdmin)

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------

## Instruction:
Abort when the page model does not have a template_key field
## Code After:

from __future__ import absolute_import

from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.db.models import FieldDoesNotExist

from .models import Page
from .modeladmins import PageAdmin

# ------------------------------------------------------------------------
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).')

admin.site.register(Page, PageAdmin)

# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
