Skip to content

Commit

Permalink
Merge pull request #255 from wmo-raf/dev
Browse files Browse the repository at this point in the history
Updates and Bug Fixes
  • Loading branch information
erick-otenyo authored Sep 5, 2024
2 parents ba58d83 + 97948eb commit b4538fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nmhs_cms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (0, 9, 21, "final", 0)
VERSION = (0, 9, 3, "final", 0)

__version__ = get_version(VERSION)

Expand Down
2 changes: 2 additions & 0 deletions nmhs_cms/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,5 @@

DEFAULT_WAGTAILDOCS_EXTENSIONS = ['pdf', 'docx', 'xlsx', 'pptx', 'csv', 'odt', 'rtf', 'txt', 'key', 'zip', 'doc']
WAGTAILDOCS_EXTENSIONS = env.list("WAGTAILDOCS_EXTENSIONS", default=DEFAULT_WAGTAILDOCS_EXTENSIONS)

CAP_ALLOW_EDITING = env.bool("CAP_ALLOW_EDITING", default=False)
10 changes: 10 additions & 0 deletions pages/cap/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
CapAlertListPage, get_currently_active_alerts, CAPAlertWebhook, CAPAlertWebhookEvent, OtherCAPSettings
)
from .utils import create_cap_geomanager_dataset
from django.conf import settings


class CAPPagePermissionHelper(PagePermissionHelper):
def user_can_edit_obj(self, user, obj):
can_edit = super().user_can_edit_obj(user, obj)

# allow editing if enabled from settings
can_edit_cap = getattr(settings, "CAP_ALLOW_EDITING", False)
if can_edit_cap:
return True

if obj.live and obj.status == "Actual":
return False

Expand Down Expand Up @@ -288,6 +294,10 @@ def copy_cap_alert_page(request, page):
def before_edit_cap_alert_page(request, page):
page = page.specific
if page.__class__.__name__ == "CapAlertPage":
# allow editing if enabled from settings
can_edit_cap = getattr(settings, "CAP_ALLOW_EDITING", False)
if can_edit_cap:
return
if page.live and page.status == "Actual":
url = AdminURLHelper(page).get_action_url("index")
messages.warning(request, gettext(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ attrs==23.1.0
beautifulsoup4==4.9.3
billiard==3.6.4.0
cachetools==5.3.0
capeditor==0.6.1
capeditor==0.6.2
Cartopy==0.22.0
celery==5.2.7
certifi==2023.07.22
Expand Down

0 comments on commit b4538fc

Please sign in to comment.