field=models.CharField(blank=True,choices=[('Occupied','Occupied'),('Unoccupied','Unoccupied')],max_length=15,null=True,verbose_name='and this status'),
@@ -716,6 +732,7 @@ class AlertCondition(models.Model):
...
@@ -716,6 +732,7 @@ class AlertCondition(models.Model):
# fields to qualify the condition test according to building mode
# fields to qualify the condition test according to building mode
only_if_bldg=models.ForeignKey(Building,models.SET_NULL,verbose_name='But only if building',blank=True,null=True)
only_if_bldg=models.ForeignKey(Building,models.SET_NULL,verbose_name='But only if building',blank=True,null=True)
only_if_bldg_mode=models.ForeignKey(BuildingMode,models.SET_NULL,verbose_name='is in this mode',blank=True,null=True)
only_if_bldg_mode=models.ForeignKey(BuildingMode,models.SET_NULL,verbose_name='is in this mode',blank=True,null=True)
only_if_bldg_status=models.CharField(verbose_name='and this status',max_length=15,blank=True,null=True,choices=(('Occupied','Occupied'),('Unoccupied','Unoccupied')))
# alert message. If left blank a message will be created from other field values.
# alert message. If left blank a message will be created from other field values.
{% for inline_admin_form in inline_admin_formset %}<divclass="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}"id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <spanclass="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <ahref="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}"class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% trans "Change" %}{% else %}{% trans "View" %}{% endif %}</a>{% endif %}
result=recip.notify(subject='BMON Test Alert',message='This is a test of a BMON notification that was sent manually by an administrator.',pushover_priority='0')
ifresult:
returnHttpResponse(f'The test notifications have been sent.')
else:
returnHttpResponse(f'Failed to send any notifications!',status=500)