MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / create_setting_recommendation

Method create_setting_recommendation

core/models.py:587–606  ·  view source on GitHub ↗

Create a setting recommendation notification. Returns (notification, created) tuple.

(cls, setting_key, recommended_value, reason, current_value=None)

Source from the content-addressed store, hash-verified

585
586 @classmethod
587 def create_setting_recommendation(cls, setting_key, recommended_value, reason, current_value=None):
588 """Create a setting recommendation notification. Returns (notification, created) tuple."""
589 key = f"setting-{setting_key}"
590 notification, created = cls.objects.update_or_create(
591 notification_key=key,
592 defaults={
593 'notification_type': cls.NotificationType.SETTING_RECOMMENDATION,
594 'priority': cls.Priority.NORMAL,
595 'title': f'Recommended Setting: {setting_key}',
596 'message': reason,
597 'action_data': {
598 'setting_key': setting_key,
599 'recommended_value': recommended_value,
600 'current_value': current_value,
601 },
602 'is_active': True,
603 'admin_only': True,
604 }
605 )
606 return notification, created
607
608
609class NotificationDismissal(models.Model):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected