Skip to content

Commit

Permalink
set message id on init
Browse files Browse the repository at this point in the history
  • Loading branch information
calellowitz committed Dec 13, 2024
1 parent e810011 commit 2c5b5fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions corehq/apps/sms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,12 @@ class ConnectMessage(Log):
received_on = models.DateTimeField(null=True, blank=True)
message_id = models.UUIDField(default=uuid4)

def __init__(self, *args, **kwargs):
# set default message id on initialization so it is available before save
super(ConnectMessage, self).__init__(*args, **kwargs)
if self.message_id is None:
self.message_id = uuid4()

@property
def outbound_backend(self):
return ConnectBackend()

0 comments on commit 2c5b5fc

Please sign in to comment.