Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
Add an option to turn off the Hero Image field
Browse files Browse the repository at this point in the history
Some sites don't need/use it, so there's a toggle to disable it
  • Loading branch information
tomkins committed Feb 15, 2017
1 parent f595b6d commit 33653b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blanc_basic_pages/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ class PageAdmin(DjangoMpttAdmin):
form = PageAdminForm

def get_fieldsets(self, request, obj=None):
content = ['hero_image', 'content']
advanced_options = ['template_name', 'published', 'login_required']

if not getattr(settings, 'PAGE_SHOW_HERO_IMAGE', True):
content.remove('hero_image')

if not SHOW_LOGIN_REQUIRED:
advanced_options.remove('login_required')

Expand All @@ -28,7 +32,7 @@ def get_fieldsets(self, request, obj=None):
'fields': ('parent', 'show_in_navigation'),
}),
('Content', {
'fields': ('hero_image', 'content'),
'fields': content,
}),
('Advanced options', {
'fields': advanced_options,
Expand Down
9 changes: 9 additions & 0 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,12 @@ password authentication - so we hide it.
If your site needs certain pages to be protected so that only logged-in users
are able to view them, change this to ``True`` and then the option will appear
in the Django admin.

PAGE_SHOW_HERO_IMAGE
====================

Default: ``True``

Shows or hides the *Hero Image* field for pages in the Django admin. By default
this is ``True``, however if the site has no need for hero images in pages then
this can be turned off.

0 comments on commit 33653b5

Please sign in to comment.