Skip to content

Commit

Permalink
- ResourceBaseForm typo: missing comma on 'was_approved' field
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Mar 22, 2022
1 parent 814e780 commit 05e19c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion geonode/base/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class Meta:
'tkeywords',
'users_geolimits',
'groups_geolimits',
'dirty_state'
'dirty_state',
'was_approved',
'was_published'
)
Expand Down
15 changes: 7 additions & 8 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ def save(self, notify=False, *args, **kwargs):
self.polymorphic_ctype.model:
self.resource_type = self.polymorphic_ctype.model.lower()

# Resource Updated
_notification_sent = False
_approval_status_changed = False
if hasattr(self, 'class_name') and (self.pk is None or notify):
if self.pk is None and (self.title or getattr(self, 'name', None)):
# Resource Created
Expand All @@ -1093,10 +1096,6 @@ def save(self, notify=False, *args, **kwargs):
recipients = get_notification_recipients(notice_type_label, resource=self)
send_notification(recipients, notice_type_label, {'resource': self})
elif self.pk:
# Resource Updated
_notification_sent = False
_approval_status_changed = False

# Approval Notifications Here
if self.was_approved != self.is_approved:
if not _notification_sent and not self.was_approved and self.is_approved:
Expand Down Expand Up @@ -1125,12 +1124,12 @@ def save(self, notify=False, *args, **kwargs):
recipients = get_notification_recipients(notice_type_label, resource=self)
send_notification(recipients, notice_type_label, {'resource': self})

# Update workflow permissions
if _approval_status_changed:
self.set_permissions()

super().save(*args, **kwargs)

# Update workflow permissions
if _approval_status_changed:
self.set_permissions()

def delete(self, notify=True, *args, **kwargs):
"""
Send a notification when a layer, map or document is deleted
Expand Down
3 changes: 1 addition & 2 deletions geonode/layers/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################

from geonode.base.forms import ResourceBaseForm
import os
import tempfile
import zipfile
Expand All @@ -30,6 +28,7 @@

import json
from geonode.utils import unzip_file
from geonode.base.forms import ResourceBaseForm
from geonode.layers.models import Layer, Attribute


Expand Down

0 comments on commit 05e19c2

Please sign in to comment.