n.save()
# Now send an email too
- msgstr = _get_notification_text(request.POST.has_key('remove_after_notify'),
- obj,
+ msgstr = _get_notification_text(obj,
request.POST['new_notification'])
send_simple_mail(settings.NOTIFICATION_FROM,
send_simple_mail(settings.NOTIFICATION_FROM,
settings.NOTIFICATION_EMAIL,
"Moderation comment on %s %s" % (obj.__class__._meta.verbose_name, obj.id),
- _get_moderator_notification_text(request.POST.has_key('remove_after_notify'),
- obj,
+ _get_moderator_notification_text(obj,
request.POST['new_notification'],
request.user.username
))
- if request.POST.has_key('remove_after_notify'):
- # Object should not be saved, it should be deleted
- obj.delete()
- return
-
# Either no notifications, or done with notifications
super(PgwebAdmin, self).save_model(request, obj, form, change)
admin.site.register(model, PgwebAdmin)
-def _get_notification_text(remove, obj, txt):
+def _get_notification_text(obj, txt):
objtype = obj.__class__._meta.verbose_name
- if remove:
- return """You recently submitted a %s to postgresql.org.
-
-This submission has been rejected by a moderator, with the following comment:
-
-%s
-""" % (objtype, txt)
- else:
- return """You recently submitted a %s to postgresql.org.
+ return """You recently submitted a %s to postgresql.org.
During moderation, this item has received comments that need to be
addressed before it can be approved. The comment given by the moderator is:
-def _get_moderator_notification_text(remove, obj, txt, moderator):
+def _get_moderator_notification_text(obj, txt, moderator):
return """Moderator %s made a comment to a pending object:
Object type: %s
Object id: %s
Comment: %s
-Delete after comment: %s
""" % (moderator,
obj.__class__._meta.verbose_name,
obj.id,
txt,
- remove and "Yes" or "No",
)
<p>
{%if original.org.email%}
New notification: <input type="text" name="new_notification" style="width:400px;" /> (<b>Note!</b> This comment is emailed to the organization!)<br/>
-<input type="checkbox" name="remove_after_notify">Delete after notification</>
+To send a notification on rejection, first add the notification above and hit
+"Save and continue editing". Then as a separate step, delete the record.
{%else%}
Organisation has <b>no email</b>, so cannot send notifications to it!
{%endif%}